Dynamic language

Nick Sabalausky a at a.a
Thu Mar 15 16:05:49 PDT 2012


"H. S. Teoh" <hsteoh at quickfur.ath.cx> wrote in message 
news:mailman.712.1331843803.4860.digitalmars-d at puremagic.com...
> On Thu, Mar 15, 2012 at 03:24:24PM -0400, Nick Sabalausky wrote:
> [...]
>> - If you can stomach the indent-scoping, Python is very well-regarded
>> and has a lot of fancy advanced features.
>
> I used to despise Python's indent-scoping too, though since then I've
> had some opportunity to use Python for build scripts (google for SCons),
> and I have to say that it certainly has its own kind of beauty to it.
> You never have to worry about closing blocks in if statements and the
> like, for example, and you never have subtle bugs like:
>
> auto func(bool x) {
> int y=0;
> if (x)
> y = 1;
> writeln("x is true");
>
> return y;
> }
>
> But I certainly sympathize with the WAT sentiment when one first learns
> that Python has indent scoping. :-)
>

I've used some Python, and I've done a fair amount of SPIN (Parallax's 
Propeller microcontroller) which also does indent-scoping. Granted, SPIN is 
a lousy language (the Propeller is awesome though) regardless of its 
indent-scoping, but still, even the indent-scoping *itself* never ceased 
being irritating for me, for various different reasons.

I do like the indent-scoping in YAML, though. But that's very different: 
It's optional in YAML and YAML's only a data langauge, not a programming 
language.

As far as SCons, though, I haven't done much with it, but I have looked into 
it. Even though it techically is Python, I'd argue that its charter leaves 
it somewhat more similar to YAML than actually writing a whole program in 
Python.

>
> [...]
>> - If you're looking for the most painful dynamic experince imaginable,
>> ActionScript2 should be at the top of your list. Make sure to use
>> all-Adobe tools, and the newest versions of each, so the whole
>> experience will be *truly* unbearable.
>
> Shouldn't that be ActionScript3?
>

I've never used ActionScript3. I've heared it's better, but I have no idea 
how much better.

ActionScript2 is truly horrid though. Almost any error that isn't an 
outright syntax error is *completely* ignored. So if you sneeze wrong near 
one end of the codebase, then something clear over in another section will 
just...act wrong, for no apperent reason. I've wasted hours on things like 
trying to figure out why an image or text wasn't showing up, or was 
displayed wrong, just becase I declared some *other* object or array and 
forgot to manually initialize it with a "new MyClass()" or a "new Array()". 
That's right: you can dereference null, but it isn't an error: it's a no-op 
that triggers a cascade of no-ops. (And shit, even the heavily-static D lets 
you declare an array and just start appending to it - and have the data 
actually *stick* and not be mysteriously gone when you try to read it back.)

The API is awful, too. MovieClip, the *foundation* of AS2-based Flash, has 
got to be the most poorly designed sprite class I've ever seen. When I 
switched to Haxe, I ended up going to great lengths to wrap MovieClip in a 
much more sane Sprite class.

I think the only way they could have made ActionScript2 worse is if they 
made it indent-syntax. Ok, and entirely removed what little declaring and 
type-tagging it does have.

And the IDE is wretched. It has one of the most awkward editors I've used, 
and the bloat...christ, the bloat gets twice as bad with each version, the 
UI gets more goofily-skinned with each version, and the bloat in CS5 - 
honest to god - it makes a fully loaded Eclipse seem downright *lean*.


> (And no, I would not touch any of this stuff with a 10-foot pole.)
>

With ActionScript, ignorance truly is bliss. I'd probably be a happier, 
[somewhat] less disgruntled man if I'd never needed to use it.

>
>> I admit though, I'm not very familiar with the extent of the
>> metaprogramming abilities of any of those languages.
> [...]
>
> I can't say I'm familiar with all the languages you listed either, but
> in my limited experience, I find that D's metaprogramming capabilities
> outright beats every other language I know by a loooong shot.
>

Yea, I do agree. Admittedly D isn't "dynamic" enough to do so called "monkey 
patching" like some languages can, but really that's a *benefit*.

>From what I've seen, dynamic and interpreted languages generally prefer to 
do runtime tricks *instead* of things we would consider "metaprogramming". 
Which does stay neatly in line with the standard dynamic/interpreted 
manifesto of "Efficiency? What's that?"

> C++ seems to come farther than most other languages, but its horrible
> template syntax is just ... unpalatable. I mean, before C++11, even
> something as straightforward as vector<vector<int>> is a syntax error.
> How ridiculous is that?!

Seriously? Christ, I knew it was bad, but I'd never have guessed anything 
like that. Even Haxe can handle that.

> Nevermind the dubious wisdom of using <> for
> template arguments in the first place (try, e.g., a template with bool
> arguments that you want to instantiate with expressions that have
> comparison operators).  Sure, C++ templates are Turing-complete. They're
> also Turing tarpits for anything except the most trivial uses.
>
> D templates + CTFE rox the sox off C++ any day.
>

God yes. The only thing I've ever seen that comes close is Nemerle, which 
takes a whole different approach that's both better and worse than D, just 
in different ways. But Nemerle's strictly locked behind the VM wall (.NET), 
so it's not exactly the same class of language as D.




More information about the Digitalmars-d mailing list