3 ms·
Hm, would you also agree that it is a flaw of Haskell that there is no difference between a value and function with no arguments in Haskell? The syntactical eq
by Argorak 13y ago
Hm, would you also agree that it is a flaw of Haskell that there is no difference between a value and function with no arguments in Haskell?
The syntactical equality between a variable and a method call on self has the advantage to make things like this possible. E.g. if i have:
foo = DataBase.lazy_load(:foo)
do_something_with(foo)
can easily be refactored to
def foo
DataBase.lazy_load(:foo)
end
do_something_with(foo)
I think that to be a strong-point of the Ruby language, speaking about values and not about the technicalities. Also, every external access to a value has to happen through a Method.
Also, you are complaining about the Rails API more than anything else. E.g. in DataMapper, it was quite obvious that those attributes do hard work (e.g. coercion), because you had to explicitly define them in the first place.
- rtpg 13y agoThere's no such thing as a function with no arguments in Haskell. f :: () -> T is a function that still takes a (meaningless) value g = map f list is just a value.
- kazagistar 13y agoAn (IO a), or even more so, a (State a) or (Reader a) very often seems exactly like a function with no arguments in any imperative language.
- Argorak 13y agoThats what I meant, everything is a function and can be expressed as one, even most syntax (the literal 1 => Num a -> a)