8 ms·
>Ruby, in contrast, seems like an absurdly complicated concatenation of weird features and strange syntax My experience is the precise opposite. Ruby seems mor
by mapgrep 7y ago
>Ruby, in contrast, seems like an absurdly complicated concatenation of weird features and strange syntax
My experience is the precise opposite. Ruby seems more consistent and straightforward than any other non lisp language I’ve used. Ubiquitous blocks and “everything is an object” gets you very far.
Compare nested list comprehensions in python to chained map/select calls in Ruby:
lesson for lesson in [school.Lesson(downloaded) for downloaded in api.downloads()] if want(lesson)]
vs
api.downloads.map{|download| School.Lesson.new(download)}.select{|lesson| want(lesson)}
Or compare the many varied required ways to do something with an array in python vs Ruby:
len(array)
“;”.join(array)
array.append(x)
Vs
array.length
array.join(“;”)
array.append(x)
Genuinely confused what you refer to with “unnecessary syntactic doodads.” Examples?
- 0x445442 7y agoYou answered your own question with your qualifier... "Ruby seems more consistent and straightforward than any other non lisp language I’ve used."
- mapgrep 7y agoIf OP just meant ruby is syntactically complex compared to lisp, there’s really no arguing with that! :-) it just applies to so many languages — any non lisp — and seems an odd thing to single out Ruby for. (Perl, on the other hand...)
- hartator 7y agoHe has replied with actual code samples. Which is valuable.
- vincent-toups 7y agoBoth sets of code samples look silly to me. In scheme all this syntactic nonsense would just be function calls and lambdas.
- tomc1985 7y agoBeauty really is in the eye of the beholder, because I agree fully with parents' statements. Then again I write Ruby for a living...
- jcranmer 7y ago> lesson for lesson in [school.Lesson(downloaded) for downloaded in api.downloads()] if want(lesson)] You could do filter(want, map(school.Lesson, api.downloads()) in Python.
- bobbylarrybobby 7y agoThis works until you have to pass additional arguments to `want` and `school.Lesson`, then it gets very messy very fast.
- Buttons840 7y ago> Ubiquitous blocks and “everything is an object” gets you very far. Blocks are not objects. So much for "everything is an object". At least, this is my understanding, I may be wrong?