The logical companion to the Which do you hate most question. What's your favorite syntax element in a programming language- what nicety to you like best? I'm sticking with the 'syntax' specification to avoid broader answers like "dynamic typing" or "is interpreted."
|
closed as not constructive by Aaronaught, Walter, Mark Trapp Jul 1 '11 at 17:42
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.
|
Monads (Example is F#)
|
|||||||||||||
|
|
As an Oracle developer, the one feature I couldn't live without is how SQL integrates simply and cleanly with PL/SQL. |
||||
|
|
PHPOn-the-fly It simply work great for inserting a function library, 3rd party API, headers, footers, and really anything else I can think of. There is no rule as to where its placed within the file, so I never have to fight with my compiler.
oh oops, I forgot my javascript I want in my footer..
For me it makes the process so much easier. |
||||
|
|
|
Surprised no one mentioned keyword methods in Smalltalk, one of the languages best features. A method can have a name broken up by colons, like:
(The To call it, you'd use each part of the name as a specifier:
I find it much more readable than |
||||
|
|
|
The ?: and ?. operators in Groovy. They handle any nulls that may happen during a sequence of method calls, so you can do stuff like:
..and not worry if there's still a pizza place open or not :) |
||||
|
|
|
In R probably the vectorization in the conditions combined with index power. This allows you to do something like :
This is a trivial example, it works with matrices, arrays, lists, more complex conditions as well. And it's a manyfold faster than any kind of looping structure. |
||||
|
|
|
When you need to construct something on the fly, it's hard to beat JavaScript's brevity.
Compared that to C#, which is a bit more verbose:
|
||||
|
|
|
Plain old
Wherever I can, I use it instead of the 1.) It minimizes the scope of variables 2.) It puts everything (declaration, initialization, increment,...) in one place. |
||||
|
|
JavascriptResize the Length of an Array length property is a not read only. You can use it to increase or decrease the size of an array.
|
|||||
|
|
Java It may sound trivial, but I like foreach + generics a lot (or maybe I just hate iterators)
comparing to:
|
||||
|
|
|
Scala: The syntax for constructor parameters:
Compare this with the Java equivalent:
The Java class is much longer than the Scala class without even defining a method. Each field has to be mentioned 4 times. Note that this Java example is generous, since I could write |
||||
|
|
|
Haskell: The
|
||||
|
|
Javaobviously the main method
Getters and Setters method Setter
Getter
|
|||||
|
