News for hackers. Stuff that matters.
Re:Perl 6 – Getting beyond static vs. dynamic [pdf] by pekk on Sunday February 22, 2015 @12:57PM (#9090199)
I always find it puzzling that people throw away dynamic typing entirely. You can't make decisions about what's best for me based on rules of thumb like "as much static typing as possible," your use cases probably don't match mine if you don't understand why anyone would want dynamic typing.
Re:Perl 6 – Getting beyond static vs. dynamic [pdf] by mmphosis on Sunday February 22, 2015 @01:53PM (#9090472)
Time, random, user input, self-modifying self-compiling code, undetermined function results, ...

I agree that there are no absolute rules. A fixed system is boring, and often very inefficient depending how you look at it. Sure my system is static, but inside the black box there is a lot of "dynamism" that I can't change without a recompile. The development environment is dynamic. Writing code, creating the rules, and creating the locked down static types are all dynamic actions. There is no need for a separation between developer/user. User can set the rules, create the workflow, compile the code on the fly. There is no need for a separation between compile and run time.

GHC is itself written in Haskell (utilizing a technique known as bootstrapping), but the runtime system for Haskell, essential to run programs, is written in C and C−−.

I don't know much about C--, but C, what Haskell's runtime is written in, is fairly dynamic.

Re:Perl 6 – Getting beyond static vs. dynamic [pdf] by maxlybbert on Sunday February 22, 2015 @11:11PM (#9092492)
http://www.cminusminus.org/ . It's meant as a compiler target, say, a portable assembly code.
Re:Perl 6 – Getting beyond static vs. dynamic [pdf] by tome on Monday February 23, 2015 @09:24AM (#9094395)
Care to say a bit about your use cases that you consider inappropriate for static typing?
Re:Perl 6 – Getting beyond static vs. dynamic [pdf] by sparkie on Sunday February 22, 2015 @03:13PM (#9090850)
The reason is simple: Using a statically typed language (particularly one with reflection capabilities), it's trivial to do pretty much anything a dynamic language is capable of doing without extra tooling, perhaps with just a bit more verbosity in code. On the other hand, attempting to simulate static typing with an entirely dynamic language doesn't happen without extra tooling around the compiler.

Even languages with strict type systems like Haskell don't entirely throw away dynamic typing. It has `unsafeCoerce` which can attempt to cast a value at runtime, and fail if it's not the right type like any dynamic language would. However, when combined with Data.Typeable, storing type information in addition to the values you're interested in allows you to turn `unsafeCoerce` into something much safer: `fromDynamic`, which doesn't cause the runtime to fail, but instead returns a Maybe type - one that either contains a successfully coerced value or Nothing - and the language forces you to check this before you can use the value. You have the best of both worlds now - the ability to write whatever dynamic typed code you want, but with the ability to fall back to a strict type system to keep things in check.

Re:Perl 6 – Getting beyond static vs. dynamic [pdf] by raiph on Sunday February 22, 2015 @06:46PM (#9091780)
Perl 6 feels dynamic but aiui its functional pieces are statically typed checked and statically call resolved unless a dynamic constraint is used. (See another of my comments in this thread for more on that.)

Aiui method calls are statically type-checked and run-time resolved with a couple exceptions. If a method name (not a method object) is in a variable, type-checking is run-time. If a class is finalized (not yet implemented), method calls are resolved at compile-time.

This is pretty sketchy info because I'm still trying to figure it all out but I'll be trying to confirm it tonight or next week and will post back here if I find out mistakes I've made or more useful info.

Re:Perl 6 – Getting beyond static vs. dynamic [pdf] by cbd1984 on Monday February 23, 2015 @05:39AM (#9093560)
> unsafeCoerce

This is the exact opposite of dynamic typing. Dynamic typing doesn't throw away type information, it uses it to perform safe conversions, not unsafe coercions.

Re:Perl 6 – Getting beyond static vs. dynamic [pdf] by tel on Monday February 23, 2015 @07:36AM (#9093923)
Haskell does safe coercions. That was the point of the op's argument, actually, but he mistakenly introduced it first through it's implemenation which, after confirming safety, uses a function called 'unsafeCoerce'.

The module is called Data.Dynamic and it is a complete dynamic type system embedded inside Haskell at runtime.

It's not very popular. Read into that whatever you like. There are some reasons to use it, perhaps, but most, to my understanding, see it as opaque and difficult to reason with.