On Thursday, 5 June 2014 at 13:32:16 UTC, Bill Baxter via Digitalmars-d-announce wrote:
On Thu, Jun 5, 2014 at 2:42 AM, Jonathan M Davis via Digitalmars-d-announce
<digitalmars-d-announce@puremagic.com> wrote:



Though I confess what horrifies me the most about dynamic languages is code
like this

if(cond)
    var = "hello world";
else
    var = 42;

The fact that an if statement could change the type of a variable is just
atrocious IMHO.


Yeh, that's possible, but that doesn't look like something anyone with any
sense would do.

The things I found most enjoyable about working on javascript were
1) REPL / fully interactive debugger
When you hit a break point you can just start typing regular js code
into the console to poke the state of your system.
And the convenience of the REPL for seeing what bits of code do as you
write them.

That's an advantage of an interpreted language, regardless of typing.

2) Duck typing / introspection ability
If you have a bunch of objects that have a .width property, and that's all you care about, you can just look for that. No need to declare an IWidthHaver interface and make all of your objects declare that they
implement it.


D's ranges are examples of this in a statically typed language. You don't care what the type of the range is, just so long as it has the right api.

Reply via email to