People tend to love programming languages for the very reason others run away with fear. Whether it's out of familiarity, learning curve or other, what are language features that insiders love and outsiders hate?
For further actions, you may consider blocking this person and/or reporting abuse
Latest comments (65)
everything in scala
Using functional style shorthand blocks
{ |i| puts i }
in Ruby to make really nice one-liners to manipulate data structures.I haven't used them very much but, Rust's
trait
s are a really interesting way of building interfaces that are composable and clean.S-expressions and dynamic binding.
They say "parentheses" but they mean the equivalence of code and data. They also say "unsafe" but they mean that they aren't used to decide themselves how and when and why evaluation happens, or to lock down the application by formal design.
Sometimes there's also a performance argument, usually it doesn't take development time into account or assumes the product will run forever without further work ever again.
Probably logic inference too, the original 'lazy generator both ways evaluating' programming style, that is used to query the database.
With great expressiveness comes great power and great responsibility, but also freedom.
picolisp.com
Groovy no return in last method line
Optionals in Swift.
When I first started learning the language, I didn't understand at all why I'd want to decide if a value could be
nil
or not. It just felt like extra unneeded complexity, but after writing Swift for over a year, it's soooo much easier to reason about code when you can be sure you don't have to think about an entire set of fail cases.It's also fantastic when you can take an optional, unwrap it at one level, and never have to worry about it being
nil
again no matter where you pass the value.I also like the guard statement in swift.
I'm assuming they are similar to Option in Scala and Optional in Java? If so, they are amazing.
Yup! Exactly that, but they're supported at the language level and every variable is, by default, not optional.
So if I write
var foo: Int = 0
, I can be sure thatfoo
will never be nil, because if I write code that even placesfoo
at risk of being nil, my program won't compile! Pretty awesome stuff.Sad but true.
Or you can view it from the other perspective: a good developer who can write clean code will never have problems to find good jobs. ;)
Guys, please, don't use Metaprogramming in business logic.
Extract it to a library and put it behind a clear abstraction.
Python for the whitespace. Ruby for the irregular but expressive syntax. C for the bare-bones language. Smalltalk for the language merged with IDE merged with OS and the underlying VM.
I think Ruby is like natural language that I can communicate with ruby instead of natural language on a daily life.
after all, all my friend become able to write ruby or only rubist is your friends ?
That's why I am learning Javascript.
I'm becoming more of a fan of static types after using Swift. I used to hate static types because of the complexity and extra code. Once you get used to types though, it's hard to go back. They add an extra level of documentation to your code and peace of mind that a function/class will only be used a certain way. Here's a non-typed function in PHP:
The problem is that anyone using this function can pass anything into the function. It does not have to be a string, it could be a number or a boolean. Plus, we don't know if the function will return a string or boolean.
We could write the same thing in Swift:
Looking at the signature of this function, we know that it can only be used by passing in a string for the value and that it will always return either a string or nil (the question mark says the return value can be nil). The types make the function safer to use and easier to understand.
You can achieve the same now in PHP since PHP 7.1 :)