eval( ) ???

classic Classic list List threaded Threaded
39 messages Options
12
Reply | Threaded
Open this post in threaded view
|

eval( ) ???

runsun
What do you guys think to have an eval() to evaluate code ?

I am thinking that this would help in area where "function as a variable"  is needed, which openscad can't do.

For example, we can have a module call Line from point P to Q :

module Line ( [P,Q], formula="sin(x)", scope=["x",[0,90,180,270]] ) { formula to be converted to points : points0 = eval( formula, scope ) (some other processings to use points0): points = .... faces= .... polyhedron( points= points, faces=faces) }
Once this is set, we can have all kinds of different shapes of Lines, generating from this single Line module.
$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets
Reply | Threaded
Open this post in threaded view
|

Re: eval( ) ???

doug.moen
My feeling is that it's more important to have first class function
values, and eval() is a poor substitute.

FWIW, first class function values is part of the set of changes that I
am currently discussing with Marius.

Doug Moen.

On 12/05/2015, runsun <[hidden email]> wrote:

> What do you guys think to have an eval() to evaluate code ?I am thinking
> that
> this would help in area where "function as a variable"  is needed, which
> openscad can't do.For example, we can have a module call Line from point P
> to Q :
>
>> module Line ( [P,Q],
> *
>> formula="sin(x)"
> *
>> ,
> *
>> scope=["x",[0,90,180,270]]
> *
>>   ){      formula to be converted to points :     points0 =
> *
>> eval( formula, scope )
> *
>>     (some other processings to use points0): points = ....    faces= ....
>>
>> polyhedron( points= points, faces=faces)}
>
> Once this is set, we can have all kinds of different shapes of Lines,
> generating from this single Line module.
>
>
>
>
> -----
>
> $  Runsun Pan, PhD
>
> $ -- OpenScad_DocTest: doc and unit test ( Github , Thingiverse  )
>
> $ -- hash parameter model: here , here
>
> $ -- Linux Mint 17.1 Rebecca x64  + OpenSCAD 2015.03.15/2015.04.01.nightly
>
>
>
>
> --
> View this message in context: http://forum.openscad.org/eval-tp12627.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.

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

Re: eval( ) ???

runsun
Indeed. A first class function will work pretty well in cases like I post above. 

Just thought of something. Since in openscad, parameters and functions are stored in different places: 

    abc=3;
    function abc()=...;


Assigning abc to a parameter, if possible, will be confusing: 


    x = abc; // function or parameter?


A possible way out of this is like what Visual Basic does:


    x = something; // assign parameter
    set x = something; // assign object


That is, set for object assignment. In openscad, could be function or module assignment. Not sure how expensive it is though. 
$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets
Reply | Threaded
Open this post in threaded view
|

Re: eval( ) ???

jon_bondy
Oh, god.  Please do not head towards Visual Basic.

On 5/13/2015 12:56 AM, runsun wrote:
Indeed. A first class function will work pretty well in cases like I post above. 

Just thought of something. Since in openscad, parameters and functions are stored in different places: 

    abc=3;
    function abc()=...;


Assigning abc to a parameter, if possible, will be confusing: 


    x = abc; // function or parameter?


A possible way out of this is like what Visual Basic does:


    x = something; // assign parameter
    set x = something; // assign object


That is, set for object assignment. In openscad, could be function or module assignment. Not sure how expensive it is though. 
$ Runsun Pan, PhD
$ -- OpenScad_DocTest: doc and unit test ( Github, Thingiverse )
$ -- hash parameter model: here, here
$ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly


View this message in context: Re: eval( ) ???
Sent from the OpenSCAD mailing list archive at Nabble.com.


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


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5863 / Virus Database: 4342/9758 - Release Date: 05/12/15



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

Re: eval( ) ???

G. Wade Johnson
In reply to this post by doug.moen
On Tue, 12 May 2015 22:17:20 -0400
doug moen <[hidden email]> wrote:

> My feeling is that it's more important to have first class function
> values, and eval() is a poor substitute.

Definitely agree that function values is a better idea. Plus eval()
almost always results in major unintended consequences.

> FWIW, first class function values is part of the set of changes that I
> am currently discussing with Marius.
>
> Doug Moen.
>
> On 12/05/2015, runsun <[hidden email]> wrote:
> > What do you guys think to have an eval() to evaluate code ?I am
> > thinking that
> > this would help in area where "function as a variable"  is needed,
> > which openscad can't do.For example, we can have a module call Line
> > from point P to Q :
> >
> >> module Line ( [P,Q],
> > *
> >> formula="sin(x)"
> > *
> >> ,
> > *
> >> scope=["x",[0,90,180,270]]
> > *
> >>   ){      formula to be converted to points :     points0 =
> > *
> >> eval( formula, scope )
> > *
> >>     (some other processings to use points0): points = ....
> >> faces= ....
> >>
> >> polyhedron( points= points, faces=faces)}
> >
> > Once this is set, we can have all kinds of different shapes of
> > Lines, generating from this single Line module.
> >
> >
> >
> >
> > -----
> >
> > $  Runsun Pan, PhD
> >
> > $ -- OpenScad_DocTest: doc and unit test ( Github , Thingiverse  )
> >
> > $ -- hash parameter model: here , here
> >
> > $ -- Linux Mint 17.1 Rebecca x64  + OpenSCAD
> > 2015.03.15/2015.04.01.nightly
> >
> >
> >
> >
> > --
> > View this message in context:
> > http://forum.openscad.org/eval-tp12627.html Sent from the OpenSCAD
> > mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


--
Understanding is a three-edged sword.      -- Kosh in "Deathwalker"

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

Re: eval( ) ???

runsun
In reply to this post by jon_bondy
If I didn't use the keyword "Visual Basic", but present it as just an idea, will you have the same resentment?

To me, borrowing idea from other language doesn't mean the entire openscad is going toward it. It all depends on how to implement to fit needs. 

Aside from that, using set for func/mod assignment does have its down side. The following does look weird :
    
   some_module( arg1, set arg2= some_func )
     
So, alternatively, we can use a func specifically designed for this (this time I won't say where the idea is from :) ):
    
   x1 = abc; // assign parameter abc
   x2 = function( abc ) ; // assign function abc

     
$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets
Reply | Threaded
Open this post in threaded view
|

Re: eval( ) ???

Miro Hrončok
I'd rather see that function names and variables are saved in the same
scope, even though it might get backwards incompatible.
Miro Hrončok

Telefon: +420777974800


2015-05-13 18:55 GMT+02:00 runsun <[hidden email]>:

> If I didn't use the keyword "Visual Basic", but present it as just an idea,
> will you have the same resentment?
>
> To me, borrowing idea from other language doesn't mean the entire openscad
> is going toward it. It all depends on how to implement to fit needs.
>
> Aside from that, using set for func/mod assignment does have its down side.
> The following does look weird :
>
>    some_module( arg1, set arg2= some_func )
>
> So, alternatively, we can use a func specifically designed for this (this
> time I won't say where the idea is from :) ):
>
>    x1 = abc; // assign parameter abc
>    x2 = function( abc ) ; // assign function abc
>
>
>
> $ Runsun Pan, PhD
> $ -- OpenScad_DocTest: doc and unit test ( Github, Thingiverse )
> $ -- hash parameter model: here, here
> $ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly
>
> ________________________________
> View this message in context: Re: eval( ) ???
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: eval( ) ???

jon_bondy
Agreed

On 5/13/2015 1:16 PM, Miro Hrončok wrote:

> I'd rather see that function names and variables are saved in the same
> scope, even though it might get backwards incompatible.
> Miro Hrončok
>
> Telefon: +420777974800
>
>
> 2015-05-13 18:55 GMT+02:00 runsun <[hidden email]>:
>> If I didn't use the keyword "Visual Basic", but present it as just an idea,
>> will you have the same resentment?
>>
>> To me, borrowing idea from other language doesn't mean the entire openscad
>> is going toward it. It all depends on how to implement to fit needs.
>>
>> Aside from that, using set for func/mod assignment does have its down side.
>> The following does look weird :
>>
>>     some_module( arg1, set arg2= some_func )
>>
>> So, alternatively, we can use a func specifically designed for this (this
>> time I won't say where the idea is from :) ):
>>
>>     x1 = abc; // assign parameter abc
>>     x2 = function( abc ) ; // assign function abc
>>
>>
>>
>> $ Runsun Pan, PhD
>> $ -- OpenScad_DocTest: doc and unit test ( Github, Thingiverse )
>> $ -- hash parameter model: here, here
>> $ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly
>>
>> ________________________________
>> View this message in context: Re: eval( ) ???
>> Sent from the OpenSCAD mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> 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
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.5863 / Virus Database: 4342/9764 - Release Date: 05/13/15


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

Re: eval( ) ???

doug.moen
In reply to this post by Miro Hrončok
Miro said: "I'd rather see that function names and variables are saved in the same scope".

That's what I want as well. This would allow functions to be first class values: you can pass them as arguments to functions, return them as results, and store them as elements of a list. No arbitrary restrictions.

On 13 May 2015 at 13:16, Miro Hrončok <[hidden email]> wrote:
I'd rather see that function names and variables are saved in the same
scope, even though it might get backwards incompatible.
Miro Hrončok

Telefon: <a href="tel:%2B420777974800" value="+420777974800">+420777974800


2015-05-13 18:55 GMT+02:00 runsun <[hidden email]>:
> If I didn't use the keyword "Visual Basic", but present it as just an idea,
> will you have the same resentment?
>
> To me, borrowing idea from other language doesn't mean the entire openscad
> is going toward it. It all depends on how to implement to fit needs.
>
> Aside from that, using set for func/mod assignment does have its down side.
> The following does look weird :
>
>    some_module( arg1, set arg2= some_func )
>
> So, alternatively, we can use a func specifically designed for this (this
> time I won't say where the idea is from :) ):
>
>    x1 = abc; // assign parameter abc
>    x2 = function( abc ) ; // assign function abc
>
>
>
> $ Runsun Pan, PhD
> $ -- OpenScad_DocTest: doc and unit test ( Github, Thingiverse )
> $ -- hash parameter model: here, here
> $ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly
>
> ________________________________
> View this message in context: Re: eval( ) ???
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> 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


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

Re: eval( ) ???

cacb
On 2015-05-13 20:19, doug moen wrote:
> Miro said: "I'd rather see that function names and variables are saved
> in the same scope".
>
> That's what I want as well. This would allow functions to be first class
> values: you can pass them as arguments to functions, return them as
> results, and store them as elements of a list. No arbitrary restrictions.

Just a point of reflection:

I think it is a mistake that OpenSCAD spends time on defining the syntax
of a language. All of the resources should be spent on improving
modelling features. I realise this is much too late given the user base
of the .scad files, but it strikes me as odd anyway.

A few years ago, I was part of a team that created an modelling
application with CAD features (it is still significant in its market
area). It used, and still uses, ACIS as its CAD core, with heavy use of
boolean operations so it is similar to OpenSCAD in some ways.

The team had a history of creating applications in the past with ad-hoc
command languages, and we found it was a bad idea in the long run. So
for the ACIS-based application we decided to use an existing language
interpreter with a documented syntax. We happened to choose JavaScript
as the core language and expressed all functionality as JavaScript
objects. It worked fine.

I am clearly not saying OpenSCAD should adopt JavaScript, but I think it
would have been easier and better if an existing language had been
adapted (AngelScript is another example) instead of developing a new one.

Anyway, I realise it is much too late.

What I would like to see is an improvement to the speed of the F6
rendering, it takes too long in some cases. Plus it would be nice with
more general sweep options and other common operations in CAD tools
(lofting is another example).

That said, OpenSCAD is my preferred application for designing 3d printed
parts! I quite enjoy it.

Carsten Arnholm


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

Re: eval( ) ???

kintel
Administrator
Hi Carsten,

OpenSCAD aim to directly describe a 3D design hierarchy, not merely execute code to spit out 3D objects.
The reason for not choosing an existing language for OpenSCAD is simply that we haven’t found any languages which fit our requirements.
So far, the closest conceptual match I’ve found is XSLT - and virtually everyone I’ve talked to having ever used XSLT would cringe on hearing those 4 letters :/
Once you look further however, you could probably model all of OpenSCAD’s behavior using a pure functional language. The challenge is that said languages tend to be less suitable for non-programmers to both read and write. Once we redefine some of OpenSCAD’s mistakes, we could probably define OpenSCAD as a syntactical front-end to such a pure functional evaluation engine.

Using a faster and more powerful CAD kernel is indeed on the radar. Sadly, the world of Open Source CAD kernels is severely limited. If we manage to get sufficient contributions or funding, working towards such a kernel would be doable. If you have any spare time, this would be a good place to start: https://github.com/openscad/openscad/wiki/Project%3A-Survey-of-CSG-algorithms

..or if someone has the experience to do so: Evaluate OpenCascade as an option. Most people I’ve talked to who’ve ever used that has strongly recommended me never to touch it though. ..but FreeCAD somehow manages.

 -Marius


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

Re: eval( ) ???

cacb
Hi Marius!

On 2015-05-14 16:22, Marius Kintel wrote:
> OpenSCAD aim to directly describe a 3D design hierarchy, not merely
> execute code to spit out 3D objects.

I do understand, and any language chosen would obviously have to support
the design hierarchy. As far as I can tell, many languages should be
able to do it. Personally, I use modules in OpenSCAD extensively, but I
would be even happier with a class concept with both member functions
and data members. A 3d hierarchy can be expressed also that way.

Anyway, this was just my thoughts. OpenSCAD has made decisions long ago,
which I respect. Perhaps one could keep the OpenSCAD language limited
and use it as an intermediate representation generated by the kind of
object oriented language I am dreaming of :-)

> Using a faster and more powerful CAD kernel is indeed on the radar.
 > Sadly, the world of Open Source CAD kernels is severely limited.
> If we manage to get sufficient contributions or funding, working
 > towards such a kernel would be doable. If you have any spare
 > time, this would be a good place to start:
> https://github.com/openscad/openscad/wiki/Project%3A-Survey-of-CSG-algorithms
>
> ..or if someone has the experience to do so: Evaluate OpenCascade as an
> option. Most people I’ve talked to who’ve ever used that has strongly
> recommended me never to touch it though. ..but FreeCAD somehow manages.

The funny thing is, I evaluated CAS.CADE (as it was known at the time)
in about 1994-1995 for the work previously mentioned. It was marketed by
Matra Datavision in France and I even went to see them a couple of
times. They had what we thought was a curious idea of their own
home-grown language (CDL) encapsulating the C++ kernel. Nowadays it
looks like some finally agree with our thoughts at the time :
http://dev.opencascade.org/doc/overview/html/occt_dev_guides__cdl.html

"Please note that CDL is considered as obsolete and is to be removed in
one of future releases of OCCT."   :-)

CAS.CADE was closed source and extremely expensive back then, but we
still struggled very hard to make use of it. The end result for us was
that it was dropped and replaced it with ACIS. Only a few years ago, I
discovered CAS.CADE had become quasi open source as OpenCascade (OCCT).
I also found there is now something called OCE - Open CASCADE Community
Edition https://github.com/tpaviot/oce/
I had the idea of trying OCE, but frankly not enough incentive and power
to do it, and my work is different now. OCE may probably be something to
be considered for OpenSCAD CAD kernel, I suspect OpenCascade has come a
long way since I saw it.

Sidenote: One thing that has struck me is that the compilation in
OpenSCAD is quite fast, but the rendering (F6) is extremely slow. I was
wondering if the generation of triangles for STL really needs the
graphical rendering to be completed first? If not, one could imagine a
function to export the compiled model to STL and use an external viewer
to speed things up when iterating on a complex design that takes forever
to render.

Carsten Arnholm



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

Re: eval( ) ???

tp3
On 05/14/2015 06:58 PM, Carsten Arnholm wrote:
> Sidenote: One thing that has struck me is that the compilation
 > in OpenSCAD is quite fast, but the rendering (F6) is extremely
 > slow. I was wondering if the generation of triangles for STL
 > really needs the graphical rendering to be completed first? If
 > not, one could imagine a function to export the compiled model
 > to STL and use an external viewer to speed things up when iterating
 > on a complex design that takes forever to render.
 >
No, F6 being slow is mainly due to the CSG processing in CGAL.
While the OpenGL rendering itself is badly in need of improvement
(or should at least get additional support for GPU based rendering)
it's not the biggest factor in most cases.

Preview (F5) is fast as there is no CSG happening on mesh level, but
it's handled by OpenCSG using clever OpenGL rendering.

STL export needs the fully generated mesh which is generally not
available after just doing a preview.

ciao,
   Torsten.


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

Re: eval( ) ???

kintel
Administrator
In reply to this post by cacb
On May 14, 2015, at 12:58 PM, Carsten Arnholm <[hidden email]> wrote:
>
> Anyway, this was just my thoughts. OpenSCAD has made decisions long ago, which I respect. Perhaps one could keep the OpenSCAD language limited and use it as an intermediate representation generated by the kind of object oriented language I am dreaming of :-)
>
There are a number of projects doing this by implementing API front-ends for various programming languages, and generate OpenSCAD code.

Also, in the ongoing language revision discussions, one of the possible features we’re discussing is to allow functions to return shapes (i.e. unify the concept of functions and modules). This would make it possible for programmers to abstract away some of the things which has to be explicit today.

 -Marius


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

Re: eval( ) ???

cacb
On 2015-05-15 03:47, Marius Kintel wrote:
> There are a number of projects doing this by implementing API
> front-ends for various programming languages, and generate OpenSCAD
> code.

Interesting, any links?

> Also, in the ongoing language revision discussions, one of the
> possible features we’re discussing is to allow functions to return
> shapes (i.e. unify the concept of functions and modules). This would
> make it possible for programmers to abstract away some of the things
> which has to be explicit today.

Better abstraction features would be great, that is in essence what I
wanted. OpenSCAD is "The Programmers Solid 3D CAD Modeller" and as a
software engineer I would like to have similar abstraction capabilities
when "programming 3d models" as when programming applications. So a move
in that direction is good.

However, improving the modelling capabilities with general sweeping etc.
is just as important.

Thanks for the great work you are doing!

Carsten Arnholm

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

Re: eval( ) ???

runsun
In reply to this post by kintel
kintel wrote
There are a number of projects doing this by implementing API front-ends for various programming languages, and generate OpenSCAD code.
Talking about this, I've been wondering why OpenSCAD doesn't have associated array like {angle:30,r:3}.

It's not like OpenSCAD doesn't need it. The existence of lookup() and search() seems to show that we do have such a need.

kintel wrote
Also, in the ongoing language revision discussions, one of the possible features we’re discussing is to allow functions to return shapes (i.e. unify the concept of functions and modules). This would make it possible for programmers to abstract away some of the things which has to be explicit today.
Cool. That would be a quantum leap. I'd also like to see the possibility of local functions inside a function. Maybe like this:

   function f ()=
       let( function insider()=... )
       do something with insider()


         

$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets
Reply | Threaded
Open this post in threaded view
|

Re: eval( ) ???

kintel
Administrator
On May 15, 2015, at 14:37 PM, runsun <[hidden email]> wrote:
>
> Talking about this, I've been wondering why OpenSCAD doesn't have associated
> array like {angle:30,r:3}.
>
That would be an interesting addition. I’ll keep it on my mental checklist.

>
> Cool. That would be a quantum leap. I'd also like to see the possibility of
> local functions inside a function.

Yes, support for lambda functions would be part of that redesign.

 -Marius


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

Re: eval( ) ???

kintel
Administrator
In reply to this post by cacb

On May 15, 2015, at 08:38 AM, [hidden email] wrote:

> On 2015-05-15 03:47, Marius Kintel wrote:
>> There are a number of projects doing this by implementing API
>> front-ends for various programming languages, and generate OpenSCAD
>> code.
>
> Interesting, any links?
>
I’m not following these very closely, so the state may vary quite a bit and I may have forgotten some:

https://github.com/avalero/OOML
https://github.com/Joaz/CrystalScad
https://github.com/farrellm/scad-clj
https://hackage.haskell.org/package/OpenSCAD-0.2.0.0
https://github.com/smcameron/opencscad
https://github.com/kevinmehall/pyscad

 -Marius


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

Re: eval( ) ???

doug.moen
In reply to this post by runsun
runsun said:
Talking about this, I've been wondering why OpenSCAD doesn't have associative
array like {angle:30,r:3}.

It's not like OpenSCAD doesn't need it. The existence of lookup() and
search() seems to show that we do have such a need.

---
I agree. Thanks for mentioning this; I will make sure to incorporate this idea.

runsun also said:
I'd also like to see the possibility of
local functions inside a function. Maybe like this:

   function f ()=
       let( function insider()=... )
       do something with insider()
---
Nested functions are definitely part of the plan.

On 15 May 2015 at 14:37, runsun <[hidden email]> wrote:
kintel wrote
> There are a number of projects doing this by implementing API front-ends
> for various programming languages, and generate OpenSCAD code.

Talking about this, I've been wondering why OpenSCAD doesn't have associated
array like {angle:30,r:3}.

It's not like OpenSCAD doesn't need it. The existence of lookup() and
search() seems to show that we do have such a need.


kintel wrote
> Also, in the ongoing language revision discussions, one of the possible
> features we’re discussing is to allow functions to return shapes (i.e.
> unify the concept of functions and modules). This would make it possible
> for programmers to abstract away some of the things which has to be
> explicit today.

Cool. That would be a quantum leap. I'd also like to see the possibility of
local functions inside a function. Maybe like this:

   function f ()=
       let( function insider()=... )
       do something with insider()








-----

$  Runsun Pan, PhD

$ -- OpenScad_DocTest: doc and unit test ( Github , Thingiverse  )

$ -- hash parameter model: here , here

$ -- Linux Mint 17.1 Rebecca x64  + OpenSCAD 2015.03.15/2015.04.01.nightly




--
View this message in context: http://forum.openscad.org/eval-tp12627p12656.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: eval( ) ???

cacb
In reply to this post by kintel
On 2015-05-15 21:59, Marius Kintel wrote:
> I’m not following these very closely, so the state may vary quite a bit and I may have forgotten some:
>
> https://github.com/avalero/OOML
> https://github.com/Joaz/CrystalScad
> https://github.com/farrellm/scad-clj
> https://hackage.haskell.org/package/OpenSCAD-0.2.0.0
> https://github.com/smcameron/opencscad
> https://github.com/kevinmehall/pyscad

Thank you!

I will have a look at these. OOML seems superficially similar to what I
was thinking about, but I just browsed it quickly so I could be wrong.
It does not seem like it is alive anymore, however. I will check it anyway.

Carsten Arnholm


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