The behaviour if intersection has changed.

classic Classic list List threaded Threaded
42 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: The behaviour if intersection has changed.

jon_bondy

Making mistakes and fixing them is part of programming.  But I would prefer a syntax that is easy to read over one that is not.  I really dislike

Print(a)

Print(b)

Print(c)

PrintLn()

vs

PrintLn(a, b, c, d)

or

Print(a, b, c, d, \n)

If one cannot find and fix a missing \n, then one probably should find a hobby (or career) other than programming

IMHO, of course.  Goes without saying


On 10/5/2020 12:48 PM, Jordan Brown wrote:
On 10/5/2020 8:08 AM, Rogier Wolff wrote:
So when you get to chose what "printf" does, you can say: most people will want the trailing \n, so we'll tack it on for them. Not the right choice: supplying the \n in the format string is simple and easy, but the other way around is not: If your printf adds the \n at the end it is NOT easy to make a printf-without-\n out of that.

If it wasn't for the huge number of bugs where programs forget to include a \n, or include one where it's not appropriate, I'd agree with you.  But people get this wrong *all* the time.  I think it would have been better to have a function that prints a line (with line termination, whatever that is) and an otherwise similar function that prints a partial line without termination.  That's what Java did with print() and println().  I have to bet that Java programs have many fewer of that class of bugs than C programs, because Java programmers have to make an explicit and obvious choice.  I think Java got it slightly wrong, by having "print" be the less common form; I think BASIC and sh got it right by having the printing statement (print, echo) default to printing a line, and optionally *not* terminate it.

I think the best strategy is to have the usual case be easy and obvious, and the advanced case be possible.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
rew
Reply | Threaded
Open this post in threaded view
|

Re: The behaviour if intersection has changed.

rew
On Tue, Oct 06, 2020 at 09:36:40AM -0400, jon wrote:

> PrintLn(a, b, c, d)
>
> or
>
> Print(a, b, c, d, \n)

You're making this about the specifics about just an example. That's
not the issue.

The thing is that from a print you can easily turn it into a function
that does println. That's function declaration and one or two lines.

In openscad, if the language provides a "for" that results in several
objects, you can easily make it into a for that returns the union
between those objects: union () for (...) ... But the other way is
tricky. So IMHO it would've been nicer to have chosen the "for returns
multiple objects" behaviour.

        Roger.

--
** [hidden email] ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
123