Earlier quoted context omitted.
If line noise, conflation of initialization and allocation, needing to box primitives for something as simple as an array, inability to pass functions, inability to define operators, and inability to overload operators, are it's best parts I'd hate to see the parts designed by committee. Any language that forces me to write BigNum five = new BigNum(5); BigNum seven = new BigNum(7); BigNum fiftyFive = five.add(seven).…
What's your perfect language? I'm genuinely interested.
Pipe Operator:
Seq.init 100 (fun x -> x*2)
|> Seq.reduce (+)
Creates a sequence of numbers from 1 to 100 multiplies them by two and then adds together.Composition operator:
let add x y = x+y
let mul x y = x*y
let addFiveMultiplyBy20 = add 5 >> mul 20
Define a class type User(firstName,lastName,email) =
property x.Name.get = x.firstName + x.lastName
I'm a little rusty on the class syntax so it might be off. Btw, the class that that would create would be fully generic with a requirement that the class of firstName and lastName have the (+) operator defined. So you could use the code: let user1 = new User("Foo","Bar","foo@bar.com")
let user2 = new User(42,24,new EmailAddress("foo@bar.com"))
As well you could do this: let (+) (x:string) (y:int) = x + y.ToString();
let (+) (x:int) (y:string) = x.ToString() + y;
let user3 = new User(42,"Bar","foo@bar.com");