3 ms·
> I heard some comparisons of Nim to Pascal as its veiled resurgence. I don't know that much about Nim, but there are a few things about it... 1. The Nim com
by amyjess 12y ago
> I heard some comparisons of Nim to Pascal as its veiled resurgence.
I don't know that much about Nim, but there are a few things about it...
1. The Nim compiler was originally written in Pascal.
2. Nim uses Pascal-style type syntax (i.e. "name: type" rather than the C-style "type name").
3. Nim syntax was inspired by Python, which in turn was heavily inspired by Modula-3, which in turn is a descendant of Pascal.
- lobster_johnson 12y agoThere are tons of influences from ObjectPascal: * Range-based subtyping: You can declare a type as being an int of 1..5. Many Pascal-derived languages (Modula, Oberon, Ada) have this. * Ranges are first-class values and can be used in loops and case statements: "for i in 0..10". * Arrays: "array[1..5] of integer" becomes "array[1..5, int]". Nim also has open arrays, just like ObjectPascal. * Enums. Almost exactly like Pascal. * Sets, eg. "set[char]", which can then assign things like {"a".."z"}, almost exactly like Pascal. * Functions like ord() and prec(). * For a long time Nim used Borland-influenced naming conventions (mainly three: TFoo for classes, PFoo for pointers to objects, FFoo for fields). Fortunately this has been deprecated. * "var", "type" etc. being block-oriented and used to declare multiple things on separate lines. * Functions/methods are called "procedures". (The Nim manual insists this is more correct. I'm not so sure.) * Case insensitive identifiers.