Page 1 of 9

Ruby (learning and language comparisons)

PostPosted: Thu Mar 05, 2020 9:47 pm
by trogluddite
MichaelBenjamin wrote:to me ruby looks like a frankenlanguage, like it took the one wierd syntax from each of a bunch of languages and threw them all together.

Dammit! I think I might have missed a couple! :oops:
I could at least have squeezed in some C style { braces } - and the Perl-golf "dollar+punctuation" globals are sooo helpful for adding default line endings to "strings" << $/
:lol:

Re: Text filtering/replacement

PostPosted: Thu Mar 05, 2020 9:57 pm
by MichaelBenjamin
.

Re: Text filtering/replacement

PostPosted: Thu Mar 05, 2020 10:06 pm
by trogluddite
MichaelBenjamin wrote:you use ruby for anything else besides sm?

Quite a bit. I learned it well before FS included it - for coding SketchUp (3D drawing program) plugins to start with. I use it for most "scripty" kind of jobs - because I think Python is even more ugly!

Re: Text filtering/replacement

PostPosted: Thu Mar 05, 2020 10:37 pm
by MichaelBenjamin
.

Re: Text filtering/replacement

PostPosted: Thu Mar 05, 2020 10:59 pm
by trogluddite
MichaelBenjamin wrote:ah, but are you kidding me,
1. ruby looks not "ugly", if anything then it looks "artistic"
2. python is the most easypeasy stuff around and far from ugly, why you think it is?

He he. I think Ruby's OK really - like most of them, you just have to figure out a formatting that you like. Python is fine capability wise, not really much different than Ruby; but I really don't like syntaxes that use significant whitespace. It always looks to me like someone did a bad cut & paste job because there are no closing braces/ends, and my usual habit in most other languages is to make temporary debug code stand out more by formatting it hard-left, because not much else goes there in a normally indented class/method body. I also get a bit annoyed with having to type "self" all over the place!

Could be worse, though. C++ has tacked on so much stuff over the years and got desperate for unambiguous token combinations that if you use all the new stuff, it just gets ridiculous.

Re: Text filtering/replacement

PostPosted: Thu Mar 05, 2020 11:14 pm
by MichaelBenjamin
.

Re: Text filtering/replacement

PostPosted: Thu Mar 05, 2020 11:25 pm
by trogluddite
Oh, "functional languages"! I had a go at Haskell for a bit, and I didn't end up with anything very "functional"! Doesn't look like code. Doesn't look like maths. And counting parentheses gets boring real quick!

Re: Text filtering/replacement

PostPosted: Thu Mar 05, 2020 11:28 pm
by MichaelBenjamin
.

Re: Text filtering/replacement

PostPosted: Thu Mar 05, 2020 11:43 pm
by trogluddite
It's the way that do...end (or {...}) code blocks get passed into method calls that I think most people struggle with at first. Once you've cracked that nut, it gets a lot easier, because it's used in a very consistent way across the whole language. The "syntax sugar" is less good, I think - it allows too many ways to write the same meaning, so that examples can be a bit inconsistent. If you don't know the language, there's no clue that two different looking codes do exactly the same thing.

Re: Text filtering/replacement

PostPosted: Thu Mar 05, 2020 11:46 pm
by lalalandsynth
What is a good way to start learning Ruby ?

I really need to get into it , I seem to be able to learn a lot of things but programming...not sure why it just seems so...hard ! hehe