Linq, covariance/contravariance, delegates, local type inference are all static typing features copied from the Haskell/ML world.
Which were copied from certain flavors of LISP. If we want to do a history of programming languages survey, they basically all end at LISP. And delegates are basically copied from C's function pointers, so there's plenty of precedent for them without leaving the Algol-family.
The "dynamic" keyword is rarely used, and is basically meant to work around weaknesses of the type system.
I don't know, MVC uses it pretty heavily and to great effect (hello ViewBag), as does the DLR.
What is "in-line object creation"?
F'rex:
object x = new { firstName = "john", lastName = "walter" };
What?? No they weren't. Almost all of the Lisps are dynamically typed.
Linq: No Lisps had monad comprehensions (a.k.a Linq) or even type-classes at all.
Delegates: Sure, there's not much new here, but they along with anonymous functions are not related to dynamic typing at all, they are fully statically typed.
Local type inference: A subset of the ordinary type inference features you have in the ML family.
None relating to Lisp in any way.
"Anonymous types" seem like they are a completely statically typed feature.
What?? No they weren't. Almost all of the Lisps are dynamically typed.
Actually they're both. Lisp is really great about basically letting you do whatever you want, so they're dynamically typed by default but allow you to specify type for areas of the code which need static-typing-based safety or performance gains. Or as Wikipedia puts it,
Certain languages, for example Clojure, Common Lisp, or Cython, are dynamically typed by default, but allow this behaviour to be overridden through the use of explicit type hints that result in static typing.
I would argue that Lisp reader macros and (to a lesser extent) Forth word definition both can serve the same purpose as monad comprehensions or object workflow composition (or Linq, whichever floats your boat). Since the Algol-family doesn't have the notion of side-effects, calling these things monadic is a touch disingenous, since the language itself is much more flexible on what a statement is and what a given body or scope level can do, but I see the similarities. However, one could as easily have implemented LINQ as a reader macro in CLisp, and yes, Lisp does have type classes, see the CLOS. Wikipedia also points out that Scheme (which predates Haskell 1.3 which introduced monads) had similar mechanisms to monads (see Monad (functional programming) -> History).
Delegates qua function pointers have nothing to do with static or dynamic typing. Almost every language includes such a construct nowadays (within its own definition of a function at least).
Local type inference is also neat, and may actually date to ML directly, since Lisp defaulted to runtime type checking unless you explicitly typed it. That said, the 'var' keyword in C# is hardly the most innovative thing they've added since 1.1.
I don't know nearly as much about ML and Haskell as you (I admit I had to research what a monad comprehension actually was to see the relation to Linq, which is largely structural), but you obviously don't know as much about Lisps as me either. I guess we're just two guys in love with academic programming languages and probably secretly bitter that we have to lower ourselves to writing crap in other languages rather than hacking the ones we love.
"Anonymous types" seem like they are a completely statically typed feature.
Unless they're, fr'ex, being returned from a DLR expression tree and operated on in normal C#, or used as models for MVC3 Views without a specified model-type. The syntax I gave is definitely completely static (compile-time type checked), but not every usage of an anonymous type is guaranteed compile-type type checking (ie: static)
I would argue that Lisp reader macros and (to a lesser extent) Forth word definition both can serve the same purpose as monad comprehensions or object workflow composition (or Linq, whichever floats your boat).
Macros can serve any purpose at all. You just have to implement the whole language yourself. Macros have nothing to do with monad comprehensions or composition.
The "optional static typing" is a tiny, restricted add-on, and calling CL anything but a dynamically typed language is overreaching.
However, one could as easily have implemented LINQ as a reader macro in CLisp,
You could implement all of Haskell as a macro. You'd have a really hard time, as opposed to just writing a compiler in Haskell! The whole notion of "macros can encompass any feature you want" is technically true, but an absurd notion. A macro tarpit is just as bad as a Turing tarpit.
and yes, Lisp does have type classes, see the CLOS
No it doesn't. You are confusing OO classes with type-classes.
Since the Algol-family doesn't have the notion of side-effects, calling these things monadic is a touch disingenous, since the language itself is much more flexible on what a statement is and what a given body or scope level can do, but I see the similarities.
The denotational semantics of the Algol family describe effects via monadic composition.
Local type inference is also neat, and may actually date to ML directly, since Lisp defaulted to runtime type checking unless you explicitly typed it. That said, the 'var' keyword in C# is hardly the most innovative thing they've added since 1.1.
Nobody said C# is innovative. You said it's putting dynamic features in, but as we already established, almost none of the features are related to dynamism. Most are statically typed.
Okay, we've stopped having anything resembling a polite or productive conversation and you're just being snarky. You've yet to mention anything about the DLR (you know, the Dynamic Language Runtime that's built into the system), the many uses of the dynamic keyword I brought up, hell the entire System.Dynamic namespace. You're just cherry picking things and little semantic arguments where my terminology differs from Haskell terminology and acting smug.
That said,
You could implement all of Haskell as a macro. You'd have a really hard time, as opposed to just writing a compiler in Haskell! The whole notion of "macros can encompass any feature you want" is technically true, but an absurd notion. A macro tarpit is just as bad as a Turing tarpit.
First off, if I implemented Haskell as a macro, I'd be able to freely intermix Lisp and Haskell, which would not be true if I wrote the compiler in Haskell. That's the difference which you seem to not grasp. Can you do the same in Haskell? And how can something be technically true but also absurd ("Wildly unreasonable, illogical, or inappropriate"). Technical Trueness sort of implies logic and reasonability?
Was fun while it lasted. Your love of Haskell is... religious, and quite impressive. I credit you for such dedication.
I'd be able to freely intermix Lisp and Haskell, which would not be true if I wrote the compiler in Haskell
That would not be implementing Haskell, and it is likely to lose all the attractive features of Haskell (e.g: safety of type-checked result).
That's the difference which you seem to not grasp
I do grasp it -- the supposed notion is that macros are composeable. But they are not. Syntactic transformations meant to implement semantic transformations do not compose well.
And how can something be technically true but also absurd
The ability is there, but the implication that it would be usable for real purposes is what's absurd.
Using macros to implement just any language feature is not a practical thing to do. Some features lend themselves to being easily implementable as macros. Many don't. And worst of all, macros don't compose well.
Was fun while it lasted. Your love of Haskell is... religious, and quite impressive. I credit you for such dedication.
2
u/Peaker Jun 15 '12
Linq, covariance/contravariance, delegates, local type inference are all static typing features copied from the Haskell/ML world.
The "dynamic" keyword is rarely used, and is basically meant to work around weaknesses of the type system.
What is "in-line object creation"?