Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

perl primary, and keeping multiple languages in your head, and ruby

by water (Deacon)
on Sep 11, 2005 at 10:23 UTC ( [id://491046]=perlmeditation: print w/replies, xml ) Need Help??

At different points in my progamming life I've had a different 'primary' language: C++, SAS, Perl, etc.

My choice of primary language has depended on what best fit my job at that time. 'Primary' never meant exclusive -- SQL and perl and bash have always been in the mix; languages like Stata and Mathematica and Postscript haved floated in and out too.

But when I 'think code', not unsurprisingly my current 'primary language' is usually the hammer I instinctively grab first.

The past few years I've been perl-primary.

Not perl-only or perl-stale -- I've had the opportunity to wrap my head around new technologies inside of and outside of perl -- but clearly perl-primary.

I like perl's pragmatism and speed. I like perl's can-do attitude. I like cpan. I use perl for my job. I use perl for my own projects.

I like perl.

Beyond perl, I've spent some time messing with scheme (sicp) and liking it. Not for work, just to expand my horizons in computer science. For me at least, Scheme is sufficiently different from Perl that the two don't collide in my head -- perhaps like learning Japanese and Russian. In contrast, maybe Spanish and Portugese would be too close.

Now I'm getting intrigued with Ruby and Ruby on Rails.

The buzz intrigues me, as does the pure OO basis, as does the pragamatic fast web apps. Coding yet another CRUD screen is getting old fast. I like the sound of conventions over configuration, and Ruby's true OO approach. And while I'm shallow to be influenced by surface design, basecamp is elegant and beautiful -- and thus great marketing for a web framework.

Just getting intrigued with the ruby idea -- I haven't downloaded it yet. I did watch the movie.

I'm not looking for folks here to jump in to praise perl web frameworks like Maypole (didn't like it) or mason (love it). (Update: hadn't seen Catalyst, now looking into it.) I'm not looking for the 'monks to run the 'perl-is-best-for-everything' flag up the flagpole.

Knowing multiple computer languages is a good thing. I like this old essay by peter norvig. Despite an amusing observation by charles miller about the risk of turning into a "whiner ... for whom the best language for any job always seems to be the one you don’t get to program in often enough to see its flaws close up."

My meditation / question here has to do with keeping two languages in my head at the same time.

Being a bear of little brain, I suspect if I start playing with ruby and like it, my 'finger-memory' of perl syntax will start to slip (like mixing Spanish and Portguese idioms, I suppose).

That's really my concern about getting into Ruby -- the semantic clashes with perl syntax, as well as possible addiction.

Anyone here have comments on keeping up their perl (have to keep my day job, after all) while pushing new syntax into their fingers and brains?

Anyone here have comments on Ruby?

water

Disclaimer: my brain is over 30 years old, which I think is relevant here.

  • Comment on perl primary, and keeping multiple languages in your head, and ruby

Replies are listed 'Best First'.
Re: perl primary, and keeping multiple languages in your head, and ruby
by adrianh (Chancellor) on Sep 11, 2005 at 13:47 UTC
    Anyone here have comments on Ruby?

    I like it. I like it a lot. I still spend most of my day with Perl 5 since that's what most of the rest of the world is using. However I think I'll end up more productive in Ruby than in Perl 5 with a little more effort on my part.

    Until Perl 6 hits the streets (and possibly afterwards - who knows), or the world finally realises what nice languages Lisp and Smalltalk are, Ruby is a darn fine language.

    To be honest I've not found it that much of a mental clash with Perl 5. The only mistakes I commonly make are adding/forgetting the $ prefix in Ruby/Perl, and a tendency to mix up def/sub.

      If one wants real OO, but not some sort of heck, Ruby is much nicer. But OO is not always that important.

        If one wants real OO, but not some sort of heck, Ruby is much nicer. But OO is not always that important.

        True, but Ruby doesn't force you to write in an OO style any more than Perl does.

Re: perl primary, and keeping multiple languages in your head, and ruby
by pg (Canon) on Sep 11, 2005 at 16:10 UTC
    That's really my concern about getting into Ruby -- the semantic clashes with perl syntax, as well as possible addiction.

    Syntax might be a little bit confusing for a while, but it usually gets settled quite quickly. Besides, you always have samples (your old code) handy. Really there is not much worry.

    As for "as well as possible addiction", why is it a problem? Doesn't matter whether it is Perl or Ruby, the one makes you an addict, is the best for you. When one person finds that Perl is the best, the other guy may feel comfortable with Ruby the most. You liked beer for quite a long time, suddenly one day you started to drink wine more and more. Beer is good, and wine is also good, enjoy whatever you like. Maybe one day you will come back to beer.

      I don't know, but I bet Robert Parker doesn't drink beer on weekends. Even if he liked it, too much risk of screwing up his palate -- wine is his professional life.

      Now, I'm no Robert Parker of perl, but you get the idea -- the tools you need to earn a living need to be kept sharp, vocation vs. avocation.

      It would be quite a large problem for almost anything real-life related.

      Ruby GEMS are nowhere near CPAN's breadth, how would you feel when you discovered that your language of choice needs creating from scratch SSL bindings, jabber, MS SQL library, bittorent etc etc?

      It's not important as long as you're living close to university, but these days, when protocols are as complicated as bittorent's or skype's, you have very little choice.

      Some people say Haskell is great "faster than C++, more concise than Perl, more regular than Python, more flexible than Ruby, more typeful than C#, more robust than Java, and has absolutely nothing in common with PHP." , I found scheme quite to my liking, but if I would like to replace perl with them, I would have to start with taking few years off, to recreate important parts of perl toolkit.

Re: perl primary, and keeping multiple languages in your head, and ruby
by hv (Prior) on Sep 12, 2005 at 00:06 UTC

    I have had the experience you fear, but the other way round.

    Way back when, my primary languages were C and TCL - I had been working on a large TCL project for about 18 months when it was abruptly canned, coincidentally shortly after I'd started delving into Perl a bit in my spare time.

    During the next 12 months I hardly touched TCL, and wrote mostly C and Perl. Then I needed to automate a remote process, and wanted to use Expect for it. Everything went fine until I needed a regular expression - not a problem, I'd been churning the things out with ease just 12 months earlier, except now I found that I couldn't work out how to escape it. Not even with the manual in front of me. My brain simply didn't want to take it.

    I spent about a day fighting the dang thing, then decided life was too short, gave up, and did it another way. I've tried to use Expect a couple of times in the 8 years since, with much the same results.

    I still believe TCL is a fine language, and maybe when Perl5/6 and Parrot are a reality I'll be able to play with it once more, knowing that I have the freedom to skip out to Perl when I need a regexp.

    Hugo

      I had similar feeling when tried regular expressions in Tcl, and it is a reason why I am not fluent in Tcl. "regexp" in Tcl is not a strong part: difficult to use and not as fast as Perl's one.

      I can't explain strength of Tcl even to myself, but it certainly possesses some wisdom that lacks in Perl: GUI made extremely easy to use there; it is somehow possible in Tcl and impossible in Perl.
      In Perl, complexity grows when module grows, whereas Tcl manages things to remain simple to use, somehow, even when behaviour is no more simple. How Tcl does that - I can't understand.

      That is why I use Tcl::Tk whenever I use GUI, and I quite often go to pure Tcl when create GUI

Re: perl primary, and keeping multiple languages in your head, and ruby
by spiritway (Vicar) on Sep 12, 2005 at 05:16 UTC

    Of course everyone is different, but I've always found that learning a new language gives me insights into the ones I already know. Fairly often, something I found tricky difficult to understand, becomes clearer when I encounter it in another language. I haven't yet found that I lose anything by adding to my knowledge. YMMV, of course...

    My brain is over 50 years old... I don't remember if it's relevant.

Re: perl primary, and keeping multiple languages in your head, and ruby
by pg (Canon) on Sep 12, 2005 at 01:28 UTC

    Played with Ruby a little bit. I have to be honest that I have never tried it before today.

    It is quite a nice language in terms of OO and simplicity. Remind you of SmallTalk.

    Just like any other languages, you might quickly find things that you don't like when you are finding things that you appreciate. It bothers me that Ruby does not support overloading of method. For example,

    class A def initialize(attr1) @attr1 = attr1 end def initialize(attr1, attr2) @attr1 = attr1 @attr2 = attr2 end def tell() puts @attr1 end end class B < A def tell(blah) puts "blah" end end b = B.new("a", "b") b.tell()

    This does not work, and complains that I passed 0 parameters to tell(), when it requires 1 parameter. So the one in subclass overwrites the one in super class.

    But do those two initialize methods in class A both work? No, only the second one works. Basically, it does not support overloading, or put in this way, the signature of the method does not consider the parameter list, but only the name.

    At the beginning, I thought that was bad that the method was overwritten and there was no warning, or error. Than my Perl knowledge comes in ;-) I ask myself "why not try to run it with ruby -w", maybe it has the -w switch just like Perl? That worked! and told me "warning: method redefined; discarding old initialize". So it does not supoprt overloading, but at least warns ;-)

      Remind you of SmallTalk.

      ...

      It bothers me that Ruby does not support overloading of method.

      As I remember, Smalltalk doesn't support method overloading in the way you describe either, so...

      tell

      is distinct from

      tell:

      Overloading methods by varying the parameter signatures is handy, but is only one way of approaching the problem. Incidentally, languages such as Perl, Python, Smalltalk (and I presume, Ruby) also won't distinguish different method signatures by their parameter types (to my knowledge), which some languages will...

Re: perl primary, and keeping multiple languages in your head, and ruby
by samizdat (Vicar) on Sep 12, 2005 at 15:18 UTC
    My brain is almost fifty years old... and I don't find that fact to be relevant. I have to switch back and forth, because I don't have time to duplicate CPAN in GEMS. I find that I do occasionally get tripped up by syntax, but mostly my brain can keep its associations separate. It does help that Ruby has added pragmatic forms of RegEx matching that mirror Perl's, but I consciously use OO RegEx when in Ruby to keep myself in that mode as much as possible. I find that I can switch gears and be productive within an hour. Certainly I miss what isn't easy in one language or the other, but I choose the language I use based on the project requirements, so I eliminate grass-is-greener regrets early in the development cycle.
      if you're still being paid to work full time with Perl, you won't forget it :-)
Re: perl primary, and keeping multiple languages in your head, and ruby
by McMahon (Chaplain) on Sep 16, 2005 at 23:53 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://491046]
Approved by skx
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2024-04-25 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found