September 04, 2012
On Tuesday, 4 September 2012 at 21:46:12 UTC, bearophile wrote:
> Fundamentalism has no place in engineering.

It just made me smile. I still sometimes use Python for small projects and I'm going to be getting more serious about learning Javascript (and maybe a variant like CoffeeScript). However, dynamic typing has frustrated me plenty of times in the past... Mr. Davis' statement reflects my feelings for it.
September 05, 2012
On Tue, 04 Sep 2012 21:18:41 +0200
Jacob Carlborg <doob@me.com> wrote:

> On 2012-09-04 15:59, Steven Schveighoffer wrote:
> >
> > This, of course, all comes from two guys who really like static typing :)  We *may* have a biased view.
> 

I like to think it's the other way around: I like static typing *because* it's better ;)

> I can tell you this, I've wished many times that I had static typing in Ruby. I've also wished quite many times I had dynamic typing in D. I think optional static typing, like Dart, sounds like a good idea.
> 

I don't know if maybe my experience is different from usual, but personally, I haven't *ever* wished I had dynamic typing in D. Templates and (on rare occasion) variants have always been perfectly sufficient (and even preferable) in any cases I've ever had.

September 05, 2012
On Tue, 04 Sep 2012 22:44:07 +0200
"SomeDude" <lovelydear@mailmetrash.com> wrote:
>
> The only experience I've had with dynamic typing (in Python), I can say I hated it. I prefer to write Java code, which I think tells a lot about my love for dynamic typing.
> 

Wow, now *that's* hard-core static typing fan :)

Languages like ActionScript 2 and PHP (ie, the worst of the dynamic bunch - or at least I *hope*) have conditioned me to develop a severe allergic reaction to any and all dynamic typing. But if my only static choice were Java, I think it's very possible I'd end up a dynamic guy (but with something more sensible than AS2 or PHP, of course). Dynamic has major flaws IMO, but Java's a pedantic rubber-coated pain.

But I can still relate, though. As much as I hate C++ (How much? This
much:
<https://semitwist.com/articles/article/view/top-d-features-i-miss-in-c>),
I'm actually still *happier* using C++ on my current "real world"
project than I was with the dynamic languages I've used in other
projects. C++ sucks, but as long I stick mainly to "C with classes",
I find it more manageable than dynamic weirdness. (But I grew up with
C/C++, so that probably does help me tolerate it.)

> Unless you are working in an environment which changes all the time, so that you need to adapt your code very quickly, dynamic languages are a waste of time above ~10,000 lines of code in my opinion.


Personally, I'd knock a zero or two off that figure.

September 05, 2012
On 2012-09-04 21:39, Adam D. Ruppe wrote:
> On Tuesday, 4 September 2012 at 19:18:05 UTC, Jacob Carlborg wrote:
>> I've also wished quite many times I had dynamic typing in D.
>
> I think we're *fairly* close with things like std.variant,
> especially combined with some helpers. Take a look:
>
> Variant a = 10;
> string b = a; // can't, and I say that's good, usually
> b = a.coerce!string; // works
>
> But, to get a dynamic feel, you don't want to write
> out coerce!type. I kinda want it to be auto. So,
>
> Variant a = 10;
> string b;
>
> b.dset = a; // dset means dynamic set
>
> This is pretty doable in D today.

When I said "dynamic typing" that was a bit misleading. It's more the dynamic nature of Ruby I like. For example:

* Open classes
* Reflection - adding methods, calling a method via a string, introspection
* Have executing code in all level of scopes
* Eval

The comparable features in a static language would probably AST-macros, annotations and similar features. If D had those features then I probably wouldn't want dynamic typing that much.

-- 
/Jacob Carlborg
September 05, 2012
On 2012-09-04 22:44, SomeDude wrote:

> The only experience I've had with dynamic typing (in Python), I can say
> I hated it. I prefer to write Java code, which I think tells a lot about
> my love for dynamic typing. I probably wouldn't mind writing some Lua
> code, but not in the large. Unless you are working in an environment
> which changes all the time, so that you need to adapt your code very
> quickly, dynamic languages are a waste of time above ~10,000 lines of
> code in my opinion.

I see your point. But I think Java is a bad example, it's too verbose and doesn't give you enough features to express the code you want to write.

-- 
/Jacob Carlborg
September 05, 2012
On 2012-09-05 08:17, Nick Sabalausky wrote:

> Wow, now *that's* hard-core static typing fan :)
>
> Languages like ActionScript 2 and PHP (ie, the worst of the dynamic
> bunch - or at least I *hope*) have conditioned me to develop a severe
> allergic reaction to any and all dynamic typing. But if my only static
> choice were Java, I think it's very possible I'd end up a dynamic guy
> (but with something more sensible than AS2 or PHP, of course).
> Dynamic has major flaws IMO, but Java's a pedantic rubber-coated pain.

ActionScript and PHP are probably two of the worst languages. Ruby is way better.

-- 
/Jacob Carlborg
September 05, 2012
On 2012-09-05 07:55, Nick Sabalausky wrote:

> I don't know if maybe my experience is different from usual, but
> personally, I haven't *ever* wished I had dynamic typing in D.
> Templates and (on rare occasion) variants have always been perfectly
> sufficient (and even preferable) in any cases I've ever had.

As I replied to Adam, "dynamic typing" was a bit misleading. It's more the dynamic nature of Ruby I like. For example:

* Open classes
* Reflection
* Eval
* Executable code in all levels of scope

So if D had something comparable, like AST-macros, better reflection and annotations I would be more happy.

-- 
/Jacob Carlborg
September 05, 2012
On 2012-09-05 00:13, Chris Cain wrote:

> It just made me smile. I still sometimes use Python for small projects
> and I'm going to be getting more serious about learning Javascript (and
> maybe a variant like CoffeeScript). However, dynamic typing has
> frustrated me plenty of times in the past... Mr. Davis' statement
> reflects my feelings for it.

I suggest you go with CoffeeScript, I see know reason to use plain JavaScript. It fixes a couple of problems with JavaScript but you can never escape that fact that it compiles down to JavaScript and that's basically the only language you can run in a browser.

-- 
/Jacob Carlborg
September 05, 2012
On Wed, 05 Sep 2012 08:39:37 +0200
Jacob Carlborg <doob@me.com> wrote:

> On 2012-09-05 08:17, Nick Sabalausky wrote:
> 
> > Wow, now *that's* hard-core static typing fan :)
> >
> > Languages like ActionScript 2 and PHP (ie, the worst of the dynamic bunch - or at least I *hope*) have conditioned me to develop a severe allergic reaction to any and all dynamic typing. But if my only static choice were Java, I think it's very possible I'd end up a dynamic guy (but with something more sensible than AS2 or PHP, of course). Dynamic has major flaws IMO, but Java's a pedantic rubber-coated pain.
> 
> ActionScript and PHP are probably two of the worst languages. Ruby is way better.
> 

Totally agree. Although the odd thing with Ruby though is any time
I use it I feel like I have no idea what's *really* going on. Maybe
it's the lax parsing rules, or maybe I just need to learn it better, I
dunno. But yea, I'll agree AS2/PHP are to dynamic typing what C++/Java
are to static typing: Bad examples ;)

September 05, 2012
On 2012-09-05 09:14, Nick Sabalausky wrote:

> Totally agree. Although the odd thing with Ruby though is any time
> I use it I feel like I have no idea what's *really* going on. Maybe
> it's the lax parsing rules, or maybe I just need to learn it better, I
> dunno. But yea, I'll agree AS2/PHP are to dynamic typing what C++/Java
> are to static typing: Bad examples ;)

As with all things: that's the beauty, but can also a problem. The fact that you can call a method without parentheses is one of the things making it possible to create so nice looking DSL in Ruby.

But if you don't know the rules or every detail of the syntax that can cause problems. Example:

a = { :b => 3, :c => 4 } # associative array
b = :b => 3, :c => 4 # syntax error

def foo (arg)
end

foo(3) # ok
foo 3 # ok
foo { :b => 3, :c => 4 } # syntax error, conflicts with the block syntax
foo :b => 3, :c => 4 # ok
foo({ :b => 3, :c => 4 }) # ok

Then, as with all languages, you can do stupid things. For example, in Ruby it's possible to overwrite the whole standard library:

class String
  # overwrite the upcase method to return lower case
  def upcase
    downcase
  end
end

This can also be really useful. You can fix a bug in a library, but put the fix in your own project. No need for recompilation or distributing patched versions of libraries. The fix is distributed with the rest of your project.

But you can do just as stupid things in C or D. For example, you can write to arbitrary memory address.

-- 
/Jacob Carlborg