Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×

Comment Re:Point? (Score 1) 158

Just to clarify, the poly counts I gave were actual triangles processed by the card when disabling texture-based rendering in Tao3D. This is the only case that always works, so it's both the fallback scenario and the worst case scenario. Therefore, that's the one I'm most interested in.

Not extruded? Why not render the text as a texture and slap it on a triangle strip?

Obviously, Tao3D does that when that's possible.

Why not render the glyphs as a large texture and make clever use of UV's?

Tao3D also does that when it makes sense.

(You'd use more triangles, 2 per character

Hmm, how do you draw a glyph with only one triangle per character? Or do you mean that we can use two triangles for multiple characters? We also can store full words in the glyph cache. But currently, we only use that for languages with ligatures such as Arabic.

but that's still way fewer than the approach you're using.

May I suggest that you should study how the Tao3D code works a little more before being so dismissive ;-)

You might also want to look at other, clearly more efficient, solutions. Take a look at three.js's ShapeGeometry. and ExtrudeGeometry -- A quick test shows great quality, with far fewer triangles.

Quick test with what? How did you create a text mesh with Three.js to start with?

Furthermore, as soon as you extrude, you need true polygonal rendering. You can't draw on a texture and render quads or two triangles as you suggested. Or if there's a way, I don't know it. So you end up with roughly the number of polygons in the base glyph x N, where N depends on extrusion parameters, e.g. if you create a bezel or not, if you round the bezel, and so on.

That being said, if you want the text to look any good, you have to emit a large number of triangles for even relatively simple text.

On the basis of my experience, I strongly disagree.

Would you please be kind enough to share your experience? That's a hot topic for me.

First, I'd like to point out that even if you can do texture-based rendering, you still need to first render to a texture with polygons or, alternatively, with triangles and a shader doing the Bezier fill.

Let's deal with two cases here. The first case is when texture-based glyph caching applies. In that case, polygon count is rarely a problem for alphabetic languages. For ideographic languages, or languages with ligatures such as Arabic, the chances of finding what you need in the glyph cache are lower, but you can still assume you will draw the same text several frames in a row, so that's still a net win. The animation may skip a bit when the text changes though... So basically, the glyph polygon count defines the worst case "skip" you can get. And westerners don't care, since they use a Latin alphabet with an appropriately low number of glyphs. So in general, we can reuse entries in the glyph cache.

Second case is when you can't use textures. Extruded 3D text is one scenario, that's hardly the only one. Then, you need true polygonal rendering. And the number of basic triangles you had for the front face is multiplied by N, which depends on the shape of the extrusion path (bezel, rounded bezel, etc). Plus this time, you need to render the polygons at every single frame, so polygon counts start playing a big role in performance.

In all cases, even with an curvature-dependent algorithm, you still need a decent number of polygons per glyph or any non-basic font looks like crap. I think the best you can do is something like one triangle per Bezier curve in the glyph (unless you want your shader to become really something). Without a Bezier shader, you need at least 5 or 6 times more (depending on how sharp the curves are). In the extrusion case, you can't use textures, and you can't use Bezier shaders either.

In short, drawing "Hello World" spinning in 3D Arial font is something that anybody can do. Fetching text from an Arabic or Chinese news site and drawing that on the screen continuously, that's a different challenge entirely, and one I reckon a Blackberry won't be able to deal with too happily. At least, that's my opinion today. You may easily prove me wrong by porting Tao3D to a Blackberry :-)

Comment Re:Video tutorials (Score 1) 158

Thought for the day: whenever designing something for other people to use, you should take all feedback from your potential users and prove to yourself why the feedback is correct before attempting to show the giver why it's wrong.

Oh, I got it backwards then. I thought you had been trying to prove me wrong all that time... Sometimes, you were right (e.g. black characters on black background). Sometimes, you've made a good point (e.g. align_vertically). Sometimes, I feel your point is less convincing (glTranslate and glColor). Sometimes, I think you are plain wrong (global state is evil), and I express disagreement. That's how a discussion goes. I enjoyed it, sorry to hear that you did't seem to.

if your default response is to prove to everyone that their feedback is so valueless to you

If it felt so valueless to me, do you think I'd still be watching for your answers and typing this in the middle of the night? I don't claim to be perfect. Please reciprocate.

Exercise for you: go **** yourself. That's just patronising.

No, that's trying to help you become an early contributor. I would not have spent the time locating the exact line to patch otherwise. Remember, open source is about you and others being able to influence Tao3D. But since you obviously don't want to do it this time, I patched it myself. Your name in lights, tadaaa.

If we were just talking about text flow in a 2D page, I would agree with you

Well, text layout is still done in a 2D text box. So align specifies the horizontal alignment and justification within a line (the frequent case), and align_vertically the alignment and justification of the lines and paragraphs vertically.

I understand that, but it's wrong. I know a lot of people laugh at the idea of using setColor and getColor as per so many OO style guides, but really, you either need to use assignments or use verb-based names, or the syntax is broken from a human cognitive perspective

It's an interesting point. Tao3D actually went the other way. A setter and a getter for a property typically have the same name. So to adjust the stereoscopic effect, you can say something like eye_distance 20, and that adjusts the property you get with eye_distance. To get the current theme of a slide, you use theme, and to set it theme "Master". I personally see the 'set' and 'get' in that case as noise. But I will admit it's a matter of personal taste. I hope you will understand that Tao3D reflects my tastes and not yours.

At the limit, we began implementing (but never finished) a system of properties named x, y, width, top and so on for coordinates. You could then use any of the following three, to your liking:

rectangle 10, 20, 30, 40
rectangle { x 10; y 20; width 30; height 40; }
rectangle { left -5; y 20; width 30; bottom 0; }
x 10; y 20; width 30; height 40; rectangle

Much like for color, the last one would also set the properties in a persistent way for following shapes to use, much like color or texture today. This means you would then be able to say something like left 20 to left-align a bunch of shapes. It's not done yet, but still in the plans.

They are broken. If you aren't willing to fix the real problems with languages, why write a new one in the first place? Why not just write a library?

I find your use of bold font and "broken" quite antagonistic to your statement that two people can be correct at the same time. You call this a real problem with languages. I just don't see it. Specifically, I don't see color "red" or glColor as broken. In doing so, I'm not saying that you are wrong, but I am not convinced by your attempt at proving me (or OpenGL) wrong either. I see it more as a taste than as a matter of right or wrong.

"show" changes state? That's not what I would expect from the English word. To "show" is just to display, present or make visible something that already exists.

In Tao3D, there is a global "visibility", a floating point value between 0 and 1, that applies to all drawings. When you use show, you change the visibility. Granted, not the best choice of verb. Find a better one, and I might patch that as well. Or you might submit one if you don't go all ballistic again at the suggestion that the code is open :-)

It's not FUD [...] But if what is conceptually one thing is distributed, you might miss a bit and attempt to define two cases for the same input pattern.

What happens in that case is well specified by the language. You know which pattern wins. Just like if you have a global variable named 'i' and a local variable named 'i' in C, you know which one is selected by the compiler. It might lead to bugs. And in the case of C, it has.

The FUD is using the might as an argument against the feature. If you read the subtext, "Be afraid of the possible consequences" turns into "That feature is evil" turns into "Don't use that language". That's the very definition of FUD in my book. Which does not mean that the fear is unfounded, by the way. But it's on the same level of risk as naming conflicts in any language. Good naming or pattern usage conventions deal with it quite well. I have yet to run into such a conflict myself.

PowerPoint users don't need that much power.

Powerpoint users are not my user base. Tao3D is to Powerpoint what a fighter jet is to a bicycle. It takes more skills and time, you can't use for your everyday shopping/business talk. But if you know how to use it, you can take advantage of the third dimension. So Tao3D was designed for those users who need the power.

in all likelihood users will be writing very, very small programs

Actually, no. One of our first users actually wrote a C++ module to read some scientific data. A typical commercial use of the software is around 5K to 10K lines of code. So not very big, but not "very, very small" either (especially given what you can do in 10K lines of Tao3D).

Your users need something that is simple, straightforward, and tightly constrained. I've worked editing company collateral, and if I'm sent a slide deck at 9:30am to use for a lunch-time meeting at 12:30, I want to be able to go in and change things quickly, without having to debug all the side-effects of persistent-state code. This means I'm not going to be able to reliably adapt and update the slides as things change.

Actually, that's not true. One thing my customers appreciate is that I edit stuff while it's showing on a projector, from a text editor in a window on my laptop. And for common tasks that fit well in a standard template, we have the web-based editor, that generates code for you.

Most of your potential marketplace aren't programmers, I am, but even I wouldn't be able to use your product in a business environment.

I agree. This is why we have the web-based and template-based editor. The idea is that you have samples of code with parameters, and that the web user interface lets you tweak only the parameters that the template designer left open. This is still work in progress, though. Most templates remain to be added.

I am an exceptionally good user to listen to, but instead of taking my input, you're telling me I'm wrong.

Did you make the "Powerpoint" argument before? Did I tell you you were wrong, ever? You write "wrong" all over the place, and "broken" in bold, not me.

Just curious, what do you mean by "exceptionally good user to listen to"? I know very little about you, sorry to ask.

First rule of startups: don't assume you know the answer

Second rule of startups: bring something new. So we don't do a Powerpoint wannabe. For that, there's Keynote, Prezi, and dozens of dead products. And LibreOffice Impress if you want free software.

(in my opinion as a potential expert user of your product, remember)

This is a bit my problem here. You already consider yourself an expert when you have not used Tao3D for one week. You are not an expert at Tao3D, sorry. Yet you insist on telling me everything I did wrong. Not helpful.

So why does the demo redraw the shapes with different colors at every frame? Because that's what my program was requesting, that's why. Now if you want to know more about the execution and drawing model of Tao3D, read this. And you'll see that it's a bit smarter than re-creating everything every frame.

No, that's what makes it hard to use. You're the designer, I'm the (potential) user -- it's not your job to tell me what I find easy or not.

Are you positioning yourself as a user, or as an alternate designer? Apparently, you tell me "this design is not good, you should have done it that way", without even having tried our current design. You think you became an instant expert by watching one video on YouTube? You think you can demand changes in the design because you are a potentialuser?

More to the point, the alternative designs you are referring to are well known. This is the model in WebGL, for example. Why do you think the DNA example would be easier to code in WebGL, Three.js or something similar? Here is a DNA-like structure, without text (that would be harder with WebGL). It's 139 lines of code, not counting the many Javascript libraries required to do it. My DNA example is 42 lines of code, with the text. That's one objective measure of simplicity...

In short, I'm not telling you what you should find easy or not. I'm telling you what I find easy or not, and I don't take at face value your theories when my own experience contradicts them. My experience tells me that Tao3D code is short, easy to write, easy to read, to the point. And that all the alternatives I tried are nowhere as good for the specific things that Tao3D is designed to do.

From the point of view of a non-coder (or even many coders) the idea of recreating the same "artefact" for each frame is confusing.

To me, talking about "frames" or the "creation of shapes" is already pretty confusing. Conceptually, drawing is immediate. The fact that it actually is not is an implementation detail.

But of course, optimising drawings and computations is important. So there are tools like cached or frame_texture to cache 3D or 2D drawings. Here is an example with cached if you are curious.

It's that word "powerful" again -- a long rope is more powerful than a short one, but it means giving the user enough rope to hang themself.

Hmmm, that does not seem to match the quote line just above that sentence. Not sure where this was supposed to go...

Again, the job of a designer is to be better than what has come before

Yes, I agree. Tao3D does something no tool I know ever did before. It enables me to create powerful real-time 3D animations in minutes. That, it does better than what has come before. The rest, I don't care. And even if I generally use Tao3D rather than Powerpoint, that does not mean it's meant to be a replacement. Powerpoint has never been described as a "programming language" that I know of. Yet if you look at the title of that Slashdot story, it says "Programming language". You brought up Powerpoint, not me.

Anyway, the original point in your criticism was that global state was evil (if I understood correctly). I answered: no, it's perfectly fine, and there are tons of industry standards to prove it.

Because the whole system is utterly opaque... Not going to use it.

Well, the source is open, there is a lot of documentation, there are many examples. The drawing logic you criticised is modelled after OpenGL, arguably the leading 3D API in the industry. What else can I do to make it less opaque? Or, by "opaque", do you mean that you are not yet familiar enough with it to understand how it works? If that's really the problem, give it a couple of weeks.
To answer the question about what you rotate: it's the objects, or what OpenGL calls the "model/view matrix". So if you say rotate_z 20; rectangle..., it's the rectangle that you rotate. Just like if you say color "red"; rectangle... you apply the color to the rectangle.
As for not using it, you are a free man! I still hope Tao3D will prove itself useful to you someday.

There's something missing here, but I can't quite put my finger on it....

Of course, you realise that it's by design that we don't force our users to type useless zeroes and to write rectangle 10, 20, 0, 30, 40, 0? For the 3D version, there's cube for example. You can also extrude 2D shapes to give them a 3D look.

You could have achieved consistency by using coordinates and vectors as abstract types

Again, playing the role of the designer here, not the user. There are dozens of other ways this could have been done. Your idea of consistency is different of mine, and your suggestion does not feel like an improvement to me. But again, the code is open. If Tao3D gives you an idea and you want to fork it to create a high-consistency version with abstract types and n-dimensional vectors, you have my blessing. But suggesting I should have done this your way or else it's broken is not helpful.

And yet people don't define PowerPoint slides by a series of command-line directives, and more people write letters in Word than LaTeX... You really need to remember who your audience is.

My audience here is Slashdot. Which last time I checked was "News for Nerds", not "News for Suits". I'm not looking for Powerpoint slide pushers. If you are a good enough coder to be able to use Tao3D instead of Powerpoint, go ahead. If you want your pointy-haired boss to reuse your slides... don't count on me. I described a programming language for 3D animations. If you really want a 3D Powerpoint, check out Aurora 3D.

Comment Re:Video tutorials (Score 1) 158

I don't like subroutine names that include something that looks like a parameter, so things like rotatex and rotatey set me on edge a bit.

If you prefer, you can use the plain rotate. But rotating along X, Y or Z is frequent enough to deserve a shortcut. Not different from CSS transform, by the way.

It gets worse when this is inconsistent, and you see a subroutine called vertical_align for vertical alignment, where the seeming parameter (vertical) is now before the generic (align), and separated by an underscore instead of run together. Not only is this an internal inconsistency, but it's inconsistent with English, as "align" is a verb, and we would put in an adverb "vertically" after the verb normally. And then it gets worse again, as the command for horizontal alignment is... "align".

You are right, align_vertically would be more sensible. Exercise for you: fix it ;-) As for align, that's the common case, so I'd rather keep it that way.

The grammatical inconsistency continues with other commands/subroutines taking on names with no verb component at all (eg the command color, with no verb or assignment operator.

That derives from OpenGL, which has glRotate and glTranslate, but glColor and not glColorize. BUT it's not inconsistent. It's actually fairly smart. The color is an attribute, and glColor just sets it. So the name is the name of the attribute you set. glRotate and glTranslate modify an attribute (the current model/view matrix), so they are verbs. Unwittingly, I applied the same logic for things that change the color state, e.g. show. Since show changes the color state, it is a verb.

I'm really not happy with the way pattern matching is used as overloading ...because you can get yourself in a mess if you split it up into different parts of the code and accidentally overwrite stuff.

How is this different from overloading? That's a FUD argument. In reality, its distributed nature is exactly what makes the construct powerful. It offers a very flexible dynamic dispatch mechanism.

For example, the Slides module draws a background for slides using theme_background. That function is provided by the default theme. But most themes will override it.

In general, this override happens only on part of the pattern. For example, most slide elements are defined by (theme, master), sometimes (theme, master, style). The "master" is the equivalent of the Powerpoint "slide master", i.e. it defines the layout, etc. If you define a new theme, you'll typically define overrides that catch everything for a given theme (e.g. for "BrightRectangles" in the last link). But you may also want to override for a specific combination.

I'm completely baffled why the whole demo recreates the shapes for every single redraw frame rather than keeping them as persistent objects (which necessitates adding a random seed in order to fake them being persistent by pulling up the same colours each time.

The Tao3D drawing model is a feature, not a bug. If you write rectangle 0, 0, 320, 200, it draws the rectangle once, and that's it. If you write rotate_z 6 * seconds; rectangle 0, 0, 320, 200, it redraws it once per second. If you change the color at every frame, then of course it has to re-create it every frame... That's what makes it dynamic and simple to use.

(The demo also demonstrates the whole potential of doing too much and drowning yourself in flash -- notice how DNA letter codes are added, then promptly disappear in a black-on-black clash and are forgotten about.)

Ah, funny, I had not noticed that... Well, don't count on me to re-record the video just for that ;-)

But the worst part is the way these rotations and coloring statements create a hidden state that affects things below in an opaque manner...

Can you cite an example of a drawing API or language that has no opaque drawing state? Windows GDI, Cocoa, OpenGL or X-Window have a drawing context. The more advanced ones have a current drawing context, because passing a hDC to every single function adds strictly zero value to the code...

and I'm not even sure it might not effect stuff above it.

It doesn't (except if there's a funny bug somewhere). Why would you even imagine that?

There's a remarkable similarity between everything I've just said and the criticisms I've read of processing/processing.js (eg Bret Victor's opinions on Khan Academy's coding tutorials [worrydream.com]), so I'm guessing this was very heavily inspired by Processing's 2D canvasses....

The problem I have with the article you linked (which is very interesting, by the way) is that it only focuses on learning something, not on actually using it. Let me just give an example. The article asks (rhetorically):

That UI is exactly as informative as this line of code:
ellipse 202, 208, 300, 300
Why do we consider the code acceptable and the UI not? Why do we expect programmers to "look up" functions in "documentation", while modern user interfaces are designed so that documentation is typically unnecessary?

The reason is simple: the first time I learn about an ellipse, I might prefer
ellipse
        horizontal_position_of_center_in_pixels 202
        vertical_position_of_center_in_pixel 208
        width_in_pixels 300
        heigh_in_pixels 300

But if now I have a small example with 4 shapes like this, I go crazy at the third one. Even more so if all graphic shapes have the same parameters in the same order, i.e. always X, Y, W, H. As is the case in Tao3D.

It's OK for a user interface to put explicit labels on dialog boxes because I don't have to type them every single time I use the f...g dialog box...

So why do we use a keyboard to enter programs? Because it's the fastest way we have found so far. There are graphical programming languages, but they are restricted to toy experiments. As long as we have to type programs in, we might as well type as little as necessary...

Comment Re:Grammar ? (Score 1) 158

Suddenly you have to look in dozens of different places to verify what the most basic features of the language are.

Not really. The parsing is defined by xl.syntax, a file that currently contains 62 lines, so it's not complicated. The semantics, on the other hand, comes from libraries, including some that are built-in. In the case of base XL, the library components implemented in XL are in builtin.xl, and the components implemented in C++ are in basics.tbl.

But XL and Tao3D put way more in libraries than regular languages. Remember when we moved from BASIC to C? In BASIC, the 'PRINT' statement was a keyword. In C, 'printf' was a library routine. I argue that the C approach is superior. So of course, an exhaustive catalog of C libraries today is a bit difficult. And there are inconsistencies. But it's still superior.

Lisp has a tiny grammar and a small standard, and that leaves us buggering about with a visual confusion of brackets and parentheses.

And XL as a grammar that is just a little bit less tiny, just enough so that you can get rid of the parentheses.

if the basic behaviour of the language is overridable at will, then it is not consistent from day to day, or from job to job.

That's already the case in any language today that has libraries provided by more than one person. Where is the consistency between C's printf, C++'s iostream and Qt's logging facilities?

XL helps you create new notations that are well suited to the task at hand. It does help you make these notations consistent or useful, not any more than a C compiler makes the name of your C functions consistent or useful.

Why on Earth is anyone going to want to override operator precedence for making a presentation?

Because it lets me define operators such as * ** and *** for bullet points, for example, so now I can write slides like this:


slide "Example",
      * "First level bullet"
      ** "Second level bullet"

There are more interesting things you can do with custom notations. Here is an example using the Animate module:


import Slides
import Animate

picture_slide "Page 1",
        page_duration 10
        [0..3, ]
                color "red"
                circle 300 * smooth_ratio, 100, 20
        [0..3, ]
                color "blue"
                circle 300 * ratio, 0, 20

        [0..6, 9..10]
                color "green"
                circle 300 * down_ratio, 0, 20

        mouse_x in [0..1000]
                color "pink", 0.3
                rotate_z 90 * ratio
                rectangle 0, 0, 300, 200

picture_slide "Page 2",
        page_duration 2, "Page 1"
        story
                text "We'll return to page 1 shortly"

Once you have learned that Animate gives you a notation [A..B] to indicate when to do something, that the notation X in [A..B] is the same thing with arbitrary values (not just the page time), and that there are variants such as [A..B, C..D] for back-and-forth motion, it becomes really useful, easy to read and quick to write. I can't voucher for your capability to remember this notation, but it turns out this one I did not invent, yet I use it regularly.

That's technically possible with any language

No. The parse tree of most languages can't be shown in such a simple form. In some cases (C++ comes to mind), you can't even parse without a good deal of semantic analysis.

I'd like to see your response to that.

Will do.

Comment Re:Point? (Score 1) 158

For the algorithms, I'll let you look at the code :-) It's mostly in path3d.cpp, text_drawing.cpp and glyph_cache.cpp.

There are several algorithms that are activated separately depending on: whether you draw flat text or extruded 3D text; whether there's a texture or not; the size of the font; and more. The primary ones are: render to textures and draw quads, render polygons for the outline and play that back, or extrude the outline with triangle strips. Then there are some tricks to minimize the number of triangles emitted. I also tried an approach where we rendered triangles and there was a fragment shader doing the bezier curve inside each triangle. That was surprisingly very inefficient on many low-end graphic cards, so I stashed it without going through with it.

That being said, if you want the text to look any good, you have to emit a large number of triangles for even relatively simple text. The text of the previous paragraph is 69475 triangles in Arial, 138950 when extruded, 171298 polygons in font "Amaze" not even extruded, 265636 with the font "Be safe", 561930 with font IthornÎt, and ... a whopping 2171202 with Apple's "Chalkduster" font.

That still doesn't answer my question about what you think is lacking in WebGL.

1. Performance (which is getting good on desktop-class devices thanks to improvements in Javascript compilation, but still terrible e.g. on mobile devices).
2. Portability. I gave as an example the fact that using a mere GLSL shader as a background on my tutorial page made it unusable for a good fraction of the readers.
3. At the time we started, Microsoft still had the position that they would never support it. They changed their mind only last year, remember? So anybody using IE before 11 has no WebGL.

Comment Re:Grammar ? (Score 1) 158

Except when it doesn't just work and you have to debug, because then what you describe as "dynamic" starts to feel like "unpredictable" and it takes far longer to work through than it should. I've only looked at a very small example, but I cannot imagine myself ever trying to teach how to program in this language. How do you teach someone to think like something with very little internal logic or consistency?

The fact that its grammar cannot be expressed as EBNF (like Ada) does not mean that it's not precise and consistent. You look at some input and at the xl.syntax file, and you know exactly what parse tree you are getting out of that input. You look at the various rewrite rules (the things given by the rewrite operator -> and you know exactly what's going to be executed and why.

Overall, the grammar is much more consistent than most other languages, if only because it's so small. As I indicated elsewhere in this discussion, scanner and parser together represent some 1500 lines of C++ code, and a syntax file that is currently 62 lines long. A complete and precise description of the core language in plain english takes about 50 pages. Compare that to the 700 pages for the C++ standard, and tell me which one is easier to teach?

If you want to look at your input in a Lisp-ish syntax, you can, there's an option in the compiler to dump the parse tree in such a format. If you build the command-line compiler for XLR, it will be xlr -parse file.xl -style debug -show. You can also try -style dbghtml to see it create HTML coloured boxes corresponding to the program structure. For example, if you have the default syntax file, input http://pastebin.com/TTbCKshW turns into http://pastebin.com/wxZX2Fc0. It's absolutely deterministic.

The additional grammar rules I mentioned earlier, e.g. the distinction between statement and expression, are there to match the way we humans read code. That's what concept programming is about.

Comment Re:Smalltalk made new keyword creation easy in 198 (Score 1) 158

So does this mean that Tao3D is call-by-value by default, and this explicitly breaks it to (effectively) call-by-value, rather than leaving the programmer to hack around with statics or constants and individual copies of arguments?

The locally function is conceptually equivalent to running its argument surrounding it with graphics state save/restore code. That's about it. So you can't deduce anything about call-by-value from it.

Now, to address your question in short, XL uses call-by-reference, and lazily evaluates the arguments as required to perform the call. Cases where you need to evaluate include: having to check against a type that is not "tree", comparing against a pattern, comparing for identity between arguments. For more details, see section 3.3. "Evaluation" of https://raw.githubusercontent..... You can also explicitly evaluate something with 'do'. In the 'if-then-else' definition given elsewhere, there is a 'do' for the bodies, to force evaluation of only that argument to if-then-else corresponding to the condition. If the condition is true, you only evaluate the true clause. If it's false, you only evaluate the false clause.

Comment Re:Smalltalk made new keyword creation easy in 198 (Score 1) 158

Semantic whitespace makes me sad. :-(

Maybe you never had to work in a large project where the project most productive guy did no care about indentation at all. Whitespace has a semantics for our brain, so we might as well make that consistent with the code. It reduces syntactic noise, in concept programming jargon.

Comment Re:Grammar ? (Score 1) 158

having noted the somewhat high-nosed, arrogant tone of your answer

Too bad you failed to note how high-nosed and arrogant your own "Seriously...!" sounded :-)

Anyone into compiler construction and wanting to / trying to use your language would want a grammar

Let me disappoint then. I don't think you can even write a valid EBNF for XL, it's too dynamic for that. Let me explain why.

First, scanning and parsing are really very simple. The scanner is 747 lines of code with comments. The parser is 659 lines of code with comments. The scanner produces a stream of tokens. The parser produces an abstract syntax tree built with exactly 8 node types: integer, real, text, name, infix, prefix, postfix or block. The abstract syntax tree is used both for code and for data. A list such as 1,2,3,4 is really a sequence of infix "comma" nodes with integers as leafs.

What makes it difficult to produce a valid EBNF for XL is that the precedence rules between operators are dynamic. They are initialised from a file called xl.syntax, but they can be changed at run-time. So, of course, I can write an EBNF for if-then-else that would be something like:

if then else = "if" condition "then" statement "else" statement

But that would be imprecise. In reality, with the default syntax, if X then Y else Z parses as (infix else (infix then (prefix if X) Y) Z) (using a Lisp-like notation). That happens because of the specifications of infix priorities for then and else given in xl.syntax. Furthermore, the meaning of this particular parse tree is only given by a "rewrite", i.e. a definition such as if X then Y else Z -> ifthenelse(X,Y,Z). It is intentionally not given by a grammar of any kind. Definitions like this are even more dynamic than the priorities. They are the XL equivalent of functions, so you use them all the time.

Even writing a valid EBNF for integer literals would be hard. XL accepts 16#FFFF_FFFF as a valid integer, but 12#FFFF is not valid because F is not a valid digit in base 12. Ada has the same problem, and most EBNF descriptions of based literals for Ada are wrong. This one for example over-simplifies things and considers 12#FF# as a valid number when I assume any valid Ada compiler would reject it. Of course, you could enumerate all the 36 cases to have a valid EBNF that actually represents the language, but at some point, you have to ask: "what's the point"? And if the idea is to describe a language that is only approximately XL, taking more space to do so than the valid C++ code describing what XL actually is, then that's another big "what's the point" in my book.

Finally, there are a number of priority-based shenanigans that were introduced to make the language easier to use, but make it even more complicated to describe in EBNF or anything like it. Here are two examples.

When you read write -A, you normally read this as "write(minus(A))". On the other hand, if you write A-B, you probably read this as "minus(A,B)". It's not logical, but that's how we read. That leads XL to pay attention to spaces surrounding operators to decide what you mean. I hear you "yuck", but it just works.

Another scenario is even worse. Consider write sin x, sin y. All the people I tried that with read it as "write(sin(x), sin(y))". Problem is that this reveals a priority inversion in our brain. If the comma has lower precedence than function calls, then it should read as write(sin(x)), sin(y). If it has higher precedence, then it should read as write(sin(x,sin(y)). None of them is right. For this reason, XL and therefore Tao3D have a notion of "expression vs. statement" implemented in the parser. Again, it's "yuck" for formal grammar nazis. But again, I don't care, because it just works.

Comment Re:Smalltalk made new keyword creation easy in 198 (Score 2) 158

Your post is long, so I'll only address a few snippets by lack of time.

Also, why do people keep making new languages with new syntax (generally with poor to missing error messages, debuggers, IDEs, documentation, and libraries) when we would so much more benefit from improved FOSS libraries for existing ones? I'd be a lot more excited about Tao if it was a JavaScript library that just supported some special format INI files.

The answer is complex. I try to address it in this article. It's not just for the sake of inventing a new language, it's because what I wanted to do I could not do with JavaScript.

Looking at a bit of the Tao overview video on SourceForge, it looks like variables don't need to be declared (ick!).

Variables need to be declared, but an assignment does declare a variable in that scope.

Also, requiring "locally" seems to imply that it has one of the worst "features/bugs" of JavaScript design for default globals? Or maybe I did not understand "locally".

The 'locally' function does not concern variables, but graphic state. It's a way to say "I don't want this rotation to escape this block". In OpenGL terminology, you can think of it as a PushMatrix/PopMatrix pair (and same for other attributes).

The main aspects of the language (like what is a code block, what is an argument) don't seem clear at first glance to me, perhaps because of various keywords being defined or seeing commas some places and not others?

I find the use of a comma without inner parentheses interesting for functions and arguments, where the comma in a sense is doing what Smalltalk keyword colons are doing. Still, it misses labelling arguments like Smalltalk, and why not drop the commas and just have all arguments separated by spaces and instead require nested expressions to be surrounded by parentheses if you are going in that direction? For example: "translate -500 100 (10 + x)"

If you define something like:

        translate X Y Z -> translate X, Y, Z

then you probably are close to what you want. In practice, this forced me to add many parentheses (as you just did), and I found using a low-priority comma to separate arguments was much more practical.

I like the clean looking syntax without semicolons at the end of lines. I'm assuming it uses indentation after a comma to define code blocks?

Yes.

It it ran on JavaScript, maybe I'd try it today...

If someone wants to give Emscripten a try ;-)

If you're the author, despite any criticism above (just half-baked opinions from watching the video for a few minutes on-and-off while writing this), I'd still encourage you to keep moving forwards with it. Looks like a lot of fun! And it is exploring some new ideas and the library looks amazing. There is no question popular computer languages (Java, JavaScript, C++) have many warts and someday it would be great to have better languages (again though, Smalltalk and message passing is my favorite, even as I move to JavaScript now for various reasons).

Thanks for the encouragements.

Still, if you haven't already, you might want to make an ANTLR ( http://www.antlr.org/ ) grammar for Tao3D and generate JavaScript for a backend to the animations which uses asm.js for speed and so it can run easily in a web browser. Then people with a compatible recent browser could just click on a link and be up and running with Tao.

I have other plans to achieve that same effect. What out for Buddda ;-)

Comment Re:Most uninteresting (Score 1) 158

Common Lisp macros allow you to create complex language extensions which are not library functions. They perform as though they are built in. Before anyone writes a "new" language they should at least survey the already existing solutions.

Yes. You can actually see XLR as a Lisp without the parentheses.

Comment Re:Most uninteresting (Score 1) 158

OK, game on. Give me the syntax for the following in Lisp, Scheme, OCaml, whatever:


import Slides
slide "Example",
        * "First bullet point, with seconds: " & seconds
        * "Second bullet point"
        ** "Second level bullet point"
        blink
                * "Third level bullet point"
        anchor
                translate mouse_x, mouse_y, 200 * sin time
                color "white"
                texture "http://www.planetaryvisions.com/images_new/4128.jpg"
                rotate_y 20 * time
                sphere 200

Things like blink, anchor or slide are all functions, of course.

Comment Re:Point? (Score 1) 158

The project actually started in 2009. And I'm not even sure that WebGL is mature enough today for some of the things we do. It's not so long ago that Microsoft adopted it. And hey, it can't even display the background shaders on http://tao3d.sourceforge.net..... Enough people started complaining that I had to remove them.

So if WebGL is not good enough for a web page, I doubt it would be good enough for many of the features in Tao3D. But one benefit of open source is that you can try and transcode it in JavaScript and see how well it works. I'm really interested to see you display 3D extruded arabic text on your 2011 Blackberry ;-)

Slashdot Top Deals

Solutions are obvious if one only has the optical power to observe them over the horizon. -- K.A. Arsdall

Working...