[OpenSCAD] Openscad Indirect Functions

doug moen doug at moens.org
Tue Oct 18 17:18:30 EDT 2016


otto said:
> On the other hand, until it has been further tested, I am very shy about
> guaranteeing the code will work everywhere.

I just finished implementing this functionality myself. Here are some
things I would include in a thorough set of unit tests:
* builtin functions like `sin` can be referenced as function values
* "closures" work correctly. If a function references a non-local variable
X, then X retains its value within the body of the function, even if the
function value outlives the scope of X.
* recursively defined functions don't cause a storage leak. This is a
problem when you are using reference counting, and you implement closures
in "the obvious way": recursive functions lead to a reference cycle, which
causes a storage leak. It took me a while to figure out how to fix this.

Doug.

On 18 October 2016 at 01:37, otto <otto at 123phase.com> wrote:

> Thanks for kind words and encouragement.
>
> RE:
> >
> > Also there's always the concern of breaking scripts, so
> > syntax changes are slower than other changes.
> >
>
> The changes are small.
>
> I am nearly sure all old scripts will work with this syntax addition.
> On the other hand, until it has been further tested, I am very shy about
> guaranteeing the code will work everywhere.
>
> Regards
> Otto
>
> On Mon, 17 Oct 2016 23:56:04 +0200
> Torsten Paul <Torsten.Paul at gmx.de> wrote:
>
> > On 10/17/2016 10:26 PM, otto wrote:
> > > I am somewhat concerned that my syntax will be passed
> > > by on the next newer and better version of OpenScad and
> > > will be obsolete.
> > >
> > Trying this out will help to get a feeling of how it works
> > and maybe find potential issues, that's very useful.
> >
> > For integration we should try finding a way that is
> > compatible with the ideas for a future language version.
> > It's likely going to be quite some time until a new
> > language version will happen, still making the task
> > unnecessary difficult is not a good idea.
> >
> > > It seems that there is very little work going on at the
> > > moment to expand the syntax.  That speaks loads about the
> > > excellent quality of the current syntax and code, since
> > > it is clearly being used widely.
> > >
> > I can only speak for myself, but the reason for very little
> > going on is totally to blame on lack of spare time.
> >
> > Also there's always the concern of breaking scripts, so
> > syntax changes are slower than other changes.
> >
> > > This is only for the sake of making it easy to download
> > > an compile reliably. I am unfamiliar with github and the
> > > ethics of cooperation on the open source site, so forgive
> > > me and inform me if this is the wrong approach to getting
> > > new code into the world and tested.
> > >
> > Working from github certainly makes things easier, I'll
> > try to build some special Windows snapshots for people
> > who just want to give it a try. Might take a couple of
> > days though...
> >
> > If you want to chat a bit more interactively, you can
> > find Marius (nickname kintel) and me (nickname teepee)
> > quite often in the #openscad IRC channel on freenode.
> > Just say hello and hang around a bit, someone will
> > notice eventually.
> >
> >   http://webchat.freenode.net/?channels=openscad
> >
> > Small note on git/github usage, it will probably help to
> > work on changes in a separate branch instead of directly
> > using master. It's usually better to merge things in
> > smaller changes that belong to a single topic (via pull
> > requests). If everything is just committed to master,
> > it's much more complicated as everything is mixed together.
> >
> > > Who else is working on the OpenScad C++/parser code here
> > > and what are they doing?
> > >
> > I'm not aware of bigger changes going on in the parser,
> > I think the latest bigger change was about better line
> > number tracking and that is in master now.
> >
> > ciao,
> >   Torsten.
> >
> >
> > _______________________________________________
> > OpenSCAD mailing list
> > Discuss at lists.openscad.org
> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20161018/aae6d183/attachment-0002.html>


More information about the Discuss mailing list