discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

OpenSCAD and JavaScript

BH
Benjamin Hill
Tue, Nov 15, 2016 8:20 PM

Please let me know if I'm rehashing old debates, I searched the forums but
didn't find a conclusive answer

I believe OpenSCAD would be more fun if it was JavaScript.  Much like
node.js, with all the functions in http://www.openscad.org/cheatsheet/ made
available to the script.

This would benefit from all the syntax checkers, formatters, linters, etc
of JS.  It could piggyback on the package/dependency managers.  You could
write really interesting logic.  Maybe even a fully browser-based OpenGL
version.

What I don't know (and I am interested in learning) are the reasons not to:
What is OpenSCAD's language good at now that it would lose if you tried to
express the same thing in JS?

http://openscad.net/ is pretty slick.
Hum, based on http://joostn.github.io/OpenJsCad/
Oh, hey.  Looks like it exists already.

Now I'm even more curious why there exists 2 ways to do it (the SCAD way
and the JS way)

_Please let me know if I'm rehashing old debates, I searched the forums but didn't find a conclusive answer_ I believe OpenSCAD would be more fun if it was JavaScript. Much like node.js, with all the functions in http://www.openscad.org/cheatsheet/ made available to the script. This would benefit from all the syntax checkers, formatters, linters, etc of JS. It could piggyback on the package/dependency managers. You could write really interesting logic. Maybe even a fully browser-based OpenGL version. What I don't know (and I am interested in learning) are the reasons not to: What is OpenSCAD's language good at now that it would lose if you tried to express the same thing in JS? http://openscad.net/ is pretty slick. Hum, based on http://joostn.github.io/OpenJsCad/ Oh, hey. Looks like it exists already. Now I'm even more curious why there exists 2 ways to do it (the SCAD way and the JS way)
TP
Torsten Paul
Tue, Nov 15, 2016 8:49 PM

On 11/15/2016 09:20 PM, Benjamin Hill wrote:

Please let me know if I'm rehashing old debates, I
searched the forums but didn't find a conclusive answer

I doubt that type of answer exists for that topic ;-).

I believe OpenSCAD would be more fun if it was JavaScript.
Much like node.js, with all the functions in http://www.openscad.org/cheatsheet/
made available to the script.

I guess the pragmatic answer would be that it might be
a bit more powerful for people who have relatively good
understanding of programming.

It would lose quite a lot of the simplicity that comes
from the specific language (try beating "cube(10);").

Now I'm even more curious why there exists 2 ways to do
it (the SCAD way and the JS way)

There is also the python "yay, no curly braces" way, and
the closure "bäh, look, we are actually really functional"
way, and likely lots of others.
The reason is probably that different people have different
opinions regarding languages, which is reasonable if they
can't even decide emacs vs. vi.
In general I think the language is not the most important
part of OpenSCAD (well, except the missing namespaces
maybe), the hard part is the underlying geometry handling.
It would be awesome to see improvements there instead of
even more similar projects with just a different syntax.
(But of cause that's my own totally subjective opinion :-)

ciao,
Torsten.

On 11/15/2016 09:20 PM, Benjamin Hill wrote: > _Please let me know if I'm rehashing old debates, I > searched the forums but didn't find a conclusive answer_ > I doubt that type of answer exists for that topic ;-). > I believe OpenSCAD would be more fun if it was JavaScript. > Much like node.js, with all the functions in http://www.openscad.org/cheatsheet/ > made available to the script. > I guess the pragmatic answer would be that it might be a bit more powerful for people who have relatively good understanding of programming. It would lose quite a lot of the simplicity that comes from the specific language (try beating "cube(10);"). > Now I'm even more curious why there exists 2 ways to do > it (the SCAD way and the JS way) > There is also the python "yay, no curly braces" way, and the closure "bäh, look, we are actually really functional" way, and likely lots of others. The reason is probably that different people have different opinions regarding languages, which is reasonable if they can't even decide emacs vs. vi. In general I think the language is not the most important part of OpenSCAD (well, except the missing namespaces maybe), the hard part is the underlying geometry handling. It would be awesome to see improvements there instead of even more similar projects with just a different syntax. (But of cause that's my own totally subjective opinion :-) ciao, Torsten.
DM
doug moen
Tue, Nov 15, 2016 11:35 PM

OpenSCAD is the pioneer, the first program of its type. It created a genre,
and now there are lots of competing projects that do the same thing in
slightly different ways. I suspect that OpenSCAD still has the biggest
community though.

OpenJSCad seems to lack a number of features of OpenSCAD. No minkowski sum,
no list comprehensions. There are probably inherent limitations in the
geometry engine. Our text primitive can render arbitrary fonts as 2D
objects, which is maybe not possible from JavaScript. (OpenJSCad has a
single "vector font".) We use CGAL for boolean operations on meshes: it's
extremely robust and stable, and I doubt the algorithms can be replicated
in JavaScript. I don't see support for animations or making videos.

I don't use JavaScript myself, and I like the OpenSCAD language. But that's
just me.

If you prefer to use JavaScript rather than learn a new language, and don't
mind the limitations, then maybe OpenJsCad is the project for you.

On 15 November 2016 at 15:20, Benjamin Hill benjaminhill@gmail.com wrote:

Please let me know if I'm rehashing old debates, I searched the forums
but didn't find a conclusive answer

I believe OpenSCAD would be more fun if it was JavaScript.  Much like
node.js, with all the functions in http://www.openscad.org/cheatsheet/
made available to the script.

This would benefit from all the syntax checkers, formatters, linters, etc
of JS.  It could piggyback on the package/dependency managers.  You could
write really interesting logic.  Maybe even a fully browser-based OpenGL
version.

What I don't know (and I am interested in learning) are the reasons not
to: What is OpenSCAD's language good at now that it would lose if you tried
to express the same thing in JS?

http://openscad.net/ is pretty slick.
Hum, based on http://joostn.github.io/OpenJsCad/
Oh, hey.  Looks like it exists already.

Now I'm even more curious why there exists 2 ways to do it (the SCAD way
and the JS way)


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

OpenSCAD is the pioneer, the first program of its type. It created a genre, and now there are lots of competing projects that do the same thing in slightly different ways. I suspect that OpenSCAD still has the biggest community though. OpenJSCad seems to lack a number of features of OpenSCAD. No minkowski sum, no list comprehensions. There are probably inherent limitations in the geometry engine. Our text primitive can render arbitrary fonts as 2D objects, which is maybe not possible from JavaScript. (OpenJSCad has a single "vector font".) We use CGAL for boolean operations on meshes: it's extremely robust and stable, and I doubt the algorithms can be replicated in JavaScript. I don't see support for animations or making videos. I don't use JavaScript myself, and I like the OpenSCAD language. But that's just me. If you prefer to use JavaScript rather than learn a new language, and don't mind the limitations, then maybe OpenJsCad is the project for you. On 15 November 2016 at 15:20, Benjamin Hill <benjaminhill@gmail.com> wrote: > _Please let me know if I'm rehashing old debates, I searched the forums > but didn't find a conclusive answer_ > > I believe OpenSCAD would be more fun if it was JavaScript. Much like > node.js, with all the functions in http://www.openscad.org/cheatsheet/ > made available to the script. > > This would benefit from all the syntax checkers, formatters, linters, etc > of JS. It could piggyback on the package/dependency managers. You could > write really interesting logic. Maybe even a fully browser-based OpenGL > version. > > What I don't know (and I am interested in learning) are the reasons not > to: What is OpenSCAD's language good at now that it would lose if you tried > to express the same thing in JS? > > http://openscad.net/ is pretty slick. > Hum, based on http://joostn.github.io/OpenJsCad/ > Oh, hey. Looks like it exists already. > > Now I'm even more curious why there exists 2 ways to do it (the SCAD way > and the JS way) > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
MK
Marius Kintel
Wed, Nov 16, 2016 1:46 AM

On Nov 15, 2016, at 15:20, Benjamin Hill benjaminhill@gmail.com wrote:

http://openscad.net/ is pretty slick.
Hum, based on http://joostn.github.io/OpenJsCad/
Oh, hey.  Looks like it exists already.

This is the better maintained one: http://openjscad.org/

Now I'm even more curious why there exists 2 ways to do it (the SCAD way and the JS way)

As Doug pointed out, the biggest difference is the underlying geometry engine. I haven’t tested the OpenJSCAD engine in a while, but it used to have pretty severe stability issues. I’ve seen some development go into that over the last year or so, so perhaps this is improving. ..and yes, font rendering in Javascript is hard :)

-Marius

> On Nov 15, 2016, at 15:20, Benjamin Hill <benjaminhill@gmail.com> wrote: > > http://openscad.net/ is pretty slick. > Hum, based on http://joostn.github.io/OpenJsCad/ > Oh, hey. Looks like it exists already. This is the better maintained one: http://openjscad.org/ > Now I'm even more curious why there exists 2 ways to do it (the SCAD way and the JS way) As Doug pointed out, the biggest difference is the underlying geometry engine. I haven’t tested the OpenJSCAD engine in a while, but it used to have pretty severe stability issues. I’ve seen some development go into that over the last year or so, so perhaps this is improving. ..and yes, font rendering in Javascript is hard :) -Marius