<peepsalot>
one of the first things it talks about is a bug in resolving variables, which seems like we have it too: https://bpa.st/JXDDA
<peepsalot>
i don't think either function or module should be able to resolve `a`
<teepee>
sequencing would be nice, but I fear that ship has sailed
<teepee>
stopping the variable hoisting would probably break lots of existing scripts
<JordanBrown[m]>
I don't see any problem at all with that program.
<teepee>
hmm, not sure about the evaluation though
<JordanBrown[m]>
It does depend on how your language is structured, but we do our variable lookups at evaluation time, and so what matters is where the a=123 is relative to the calls.
<JordanBrown[m]>
Of course, even then we are weird in that we do all assignments before all module calls, so the a=123 could be anywhere relative to the foo() and it would be OK.
<JordanBrown[m]>
And if the original C compilers weren't lame, and if everybody and his brother hadn't copied that lameness, it would all be OK. Requiring stuff to be declared before it's used was a non-thing in the 1970s when people routinely did two-pass compilers.
<peepsalot>
JordanBrown[m]: did you run it and see the result?
<JordanBrown[m]>
I hadn't, but now I have. It says exactly what I predicted it to say.
<JordanBrown[m]>
What problem are you seeing?
<peepsalot>
well the really weird thing is if you move the assignment of a to the last line
<JordanBrown[m]>
Then I would expect the function to give an error and the module to succeed.
<peepsalot>
that's not how closures work though
<JordanBrown[m]>
yep
<JordanBrown[m]>
Like I said, we are weird in that we run all assignments before all module calls.
<JordanBrown[m]>
There's no closure there. It's straight scoping.
<JordanBrown[m]>
But I'm sorry, I just sat down and am now being called away to dinner.
<JordanBrown[m]>
I will read what you write when I get back, ~2 hours.
<peepsalot>
`a` should be resolved from the point of function definition, not the call site. if you say that openscad evaluates all assignments first, then why should it matter if `a` is assigned before or after the function call site?
<InPhase>
It's about the evaluation order.
<InPhase>
peepsalot: I sufficiently confused myself with this variant that resolving it made it clearer: https://bpa.st/IXTTW
<InPhase>
Note "bar", 234, with respect to "called baz"
<InPhase>
i.e., it's multi-pass.
<peepsalot>
ah, just like Leeloo Dallas
<peepsalot>
InPhase: in seriousness, i guess I understand the logic behind it now. still feels odd though
foul_owl has quit [Quit: WeeChat 2.3]
foul_owl has joined #openscad
Lagopus has quit [Read error: Connection reset by peer]
Lagopus` has joined #openscad
<InPhase>
:)
<InPhase>
And yes, it's a bit odd.
<InPhase>
If it were known at the start what we know now about a good plan for OpenSCAD, I bet it would be a bit different.
<InPhase>
I am convinced that a better design for OpenSCAD would have been built around first-class functions that also provide object literals and thus modules would have never been invented. I don't think the same sort of multi-pass approach would be required then.
<InPhase>
Behavior would be determined by type rather than syntax, and everything would be a value.
teepee_ has joined #openscad
<teepee_>
InPhase: do you have the openscad command for the video? I need to try getting the size below 10mb for posting on mastodon
<InPhase>
I put them in the repository.
<teepee_>
I see only the frames->webp command there
<InPhase>
Oh, I didn't do that command line.
teepee has quit [Ping timeout: 255 seconds]
teepee_ is now known as teepee
<InPhase>
I do the generation in gui so I can align the borders perfectly.
<teepee>
ahh, ok :)
<teepee>
how many frame did you generate?
<InPhase>
30fps
<InPhase>
For JustinSDK, 600 frames
<InPhase>
So 20 seconds.
<InPhase>
I recommend a target time of 20 seconds.
<InPhase>
Otherwise the dynamics are lethargic or too fast.
<InPhase>
300 frames with webp should be 8MB, because I did that in one try.
<InPhase>
Swap the 33 in the img2webp with 66.
<teepee>
cool, I'll try that. I can reduce the resolution a bit too I think
<InPhase>
Right.
<InPhase>
70% of the original x/y dimensions should get you under 10MB at 30fps.
<InPhase>
My dimensions were 1259x795 according to the identify command.
<InPhase>
Just be sure to check zoom alignment to avoid clipping at left t=0, top t=0.3, bottom t=0.6, and right t=1
<teepee>
hmm, I thought I have your color scheme installed, but it's not showing up
<InPhase>
Yeah, I invented a new one just for this.
<othx>
linext linked to "Low Poly Ornament Bulb by jesse" on thingiverse => 1 IRC mentions
LordOfBikes has joined #openscad
<InPhase>
linext: You can submit it early to the 2023 calendar. (After teepee opens that up.)
<teepee>
the repo already exists :)
<InPhase>
Wow, you're as ahead of the game on Christmas as a retail outlet!
L29Ah has quit [Ping timeout: 256 seconds]
<teepee>
converted the animation to gif, just about under 10mb after running imagemagick, gifsicle optimized to 5.9mb
<InPhase>
Excellent.
J2352 has joined #openscad
J23 has quit [Ping timeout: 260 seconds]
use-value has quit [Remote host closed the connection]
use-value has joined #openscad
<JordanBrown[m]>
peepsalot as InPhase said, there's no parse-time variable binding. We don't do lookups until execution time.
<JordanBrown[m]>
And sometimes even at execution time we do weird things. In particular, consider
<JordanBrown[m]>
sin = function (a) a*2;
<JordanBrown[m]>
echo(sin(90));
<JordanBrown[m]>
will echo 180.
<JordanBrown[m]>
sin = 123;
<JordanBrown[m]>
echo(sin(90))
<JordanBrown[m]>
will echo ... drum roll please ...
<JordanBrown[m]>
1
<JordanBrown[m]>
It starts to process the function call, looks up the variable, gets the number, says "nah, that's not a function", and falls back to built-ins.
<JordanBrown[m]>
If we were starting from zero, the #1 thing I would say is "don't invent your own language".
<JordanBrown[m]>
That is, if we were starting from zero with what we know now.
Lagopus` has joined #openscad
Lagopus` has quit [Changing host]
ur5us has quit [Ping timeout: 246 seconds]
milza has quit [Quit: milza]
milza has joined #openscad
L29Ah has joined #openscad
use-value has quit [Remote host closed the connection]