Alex Rivera | Logout

F# vs C# vs Nemerle

Asked 2010-12-30T09:37:21.447
35

Got new project in my TODO and can't chose F# or Nemerle.

I'm currently learning F# and have some projects on Nemerle.

I like F# way , I like indent by default (also I want indent by default for nemerle2), I like many features and magic of F# but there is no macros.

The goal of F# is VS2010 and maybe (maybe) bigger developers team and it's looking like Haskell(can create light Linux programs with it and it's fun).

The goal of Nemerle is macros and I think I like some syntax of Nemerle more.

and most people just like C#...

  • So the language must be perspective
  • Syntax must be logical , easy to understand, neat and powerfull(less code)
  • It must be easy to use with .NET
  • So I already closed my self with the chose of this 3 ones.
  • I can use them all but what about chose one. It's not so easy for me.

just for example I like (Nemerle)

match(STT)
    | 1 with st= "Summ"
    | 2 with st= "AVG" =>
        $"$st : $(summbycol(counter,STT))"

much more then (F#)

let (|Let|) v e = (v, e)

match stt with 
| Let "Summ" (st, 1) 
| Let "AVG" (st, 2) -> srintf "%s ..." st

F# :

["A"; "B"] |> List.iter (fun s  -> printfn "%d"  s.Length)

Nemerle:

["A", "B"].Iter(x => printf("%d", x.Length))

F# (hope not mistaken here):

let type X =
    let mytable a = ""
    let mytable b = ""
    new(A, B) = {
    a <- A
    b <- B }
    member X.A 
        with get  = a
    member X.B 
        with get  = a

Nemerle :

[Record]
class X
  public A : string { get; }
  public B : string { get; }

C# :

class X
{
    private readonly string _a;
    public string A { get { return _a; } }

    private readonly string _b;
    public string B { get { return _b; } }

    publ
Edit
Report

2 Answers

4

The syntax for an F# record is

type X = { 
    A : string
    B : string 
}

As for the code you can't convert

[<AbstractClass>]
type ABase() =
    abstract A : string

type IB = 
    abstract B : string

type MyClass(a, b) = 
    inherit ABase()
        override this.A = a
    interface IB with 
        member this.B = b

I'm not too sure what your pattern matching example is trying to do, but F# has the syntax (I think you're looking for)

match (STT) with
    | 1 when st = "Sum" -> ...
    | 2 when st = "Avg" -> ...
answered 2010-12-30T15:19:35.093
2

"Clearly Nemerle code is easier to support and more readable."

Easier to support to whom?

More readable to whom?

Upon what are you basing that judgement other than your own experience of the language and your own personal biases? I've coded in C++ for years and therefore I find any language which doesn't use curly braces to delimit code blocks a bit counter-intuitive. But other people who've coded in Lisp (or Lisp-based languages) would probably find the notion of using curly braces very odd and therefore counter-intuitive. People who've coded in Pascal or Pascal-based languages would rather see "begin" and "end" to delimit code blocks--they'd find that "easier to support and more readable".

Do you have any studies that prove that code comprehension is higher with Nemerle syntax than F# or C#? Because that would be the only empirical, objective measure I can think of which would prove that Nemerle code is "easier to support and more readable".

To the professional developer, it's just three different syntaxes. Unless you're comparing some language to Brainf*ck basically it's just a question of what sort of syntax you're already used to and how long you have to learn a new syntactic structure.

answered 2010-12-30T14:59:35.087

Your Answer