Perl 6

Apr. 26th, 2007 11:38 am
prog: (monkey)
[personal profile] prog
I feel the gentle winds of conventional wisdom buffeting me towards Ruby.

Is there a practical reason why I might want to do this? Coz if I learned it just for S&G but then didn't immediately start using it for serious, I'd forget it.

"Dude, Rails" is not a sufficient reason, unless you can tell me why I'd want to use Rails over any Mason-based solution.

(Referring to Ruby as "Perl 6" is from [livejournal.com profile] xach, and the funniest in-joke I've heard all week.)

Date: 2007-04-26 04:10 pm (UTC)
From: [identity profile] jaq.livejournal.com
Is there ever a practical reason for learning a programming language when you already know several that would 'do the job'?

I like Ruby. It manages to be simple and terse at the same time. I can't write Perl without a reference book on the desk, whereas in Ruby I can generally guess methods I don't know and they will work.

I learned about closures through learning Ruby, and now it is frustrating to use a language without them. It's certainly not the only language with closures but they are a central part of Ruby style.

I also use Rails for a few personal projects, but I know nothing about Mason so I can't compare.

The whole JRuby thing with Sun backing it is worth watching too.

Date: 2007-04-26 05:45 pm (UTC)
From: [identity profile] dougo.livejournal.com
Is there ever a practical reason for learning a programming language when you already know several that would 'do the job'?

Sure, if a new language would 'do the job' better than the ones you know. Where 'better' means you could do it more quickly, or it would be more maintainable, or more efficient, or whatever.

Date: 2007-04-26 04:49 pm (UTC)
From: [identity profile] novalis.livejournal.com
Mason does code in templates.
Rails does that, plus model/view/controller routing, plus object-relational mapping.

But it's no reason to learn Ruby. Learn Python instead, and use Pylons, which is just the same as Rails except a bit less magic.

Or maybe Maypole is good enough that you can just use your existing Perl skills in a similar framework.

Date: 2007-04-26 05:47 pm (UTC)
From: [identity profile] dougo.livejournal.com
Or use Flapjax, and you already know ECMAScript!

Date: 2007-04-26 04:49 pm (UTC)
From: [identity profile] chocorisu.livejournal.com
I get the impression that Ruby is one step closer to Lisp than Python. Very expressive, clean syntax, but lacks mature libraries and has severe performance penalties. In other words, a great prototyping language and perfect for smaller projects.

I haven't had a chance to sit down and learn it but I looked at the syntax and it seems like an easy one to pick up.

Date: 2007-04-26 04:58 pm (UTC)
cnoocy: green a-e ligature (Default)
From: [personal profile] cnoocy
Ruby seems fine. But I find it hard to take a language seriously in which "5.days.from_now" is a valid expression.

Date: 2007-04-26 07:19 pm (UTC)
From: [identity profile] jaq.livejournal.com
Technically "5.days.from_now" is an extension in the Rails libraries, rather than core Ruby. I think it expresses what it means quite nicely though.

Date: 2007-04-26 05:03 pm (UTC)
From: [identity profile] karlvonl.livejournal.com
I personally love Ruby, but that's probably mostly because it's the scripting language that I learned, rather than say Perl or Python. But if you already know Python, I'm not sure there's a compelling reason to switch to Ruby. That is, unless you're a big fan of object-oriented programming. Ruby is object-oriented through and through, as opposed to Perl and Python which sort of have OO bolted on. Heck, Ruby is the only language I've ever used that's so OO that you can actually call methods directly on literals, e.g.:

"Hello world".reverse
3.15.round

Also, Ruby's introspection and meta-programming facilities are very powerful, and make it a popular choice for developing domain specific languages.

And then, of course, there's the cartoon foxes:
http://poignantguide.net/ruby/whatisit.html
Chunky bacon!

Date: 2007-04-26 05:49 pm (UTC)
From: [identity profile] dougo.livejournal.com
Ruby is the only language I've ever used that's so OO that you can actually call methods directly on literals

What, Java doesn't count? Strings are objects, just not numbers. (Although I wouldn't be surprised if that was added in Java 6.)

Date: 2007-04-26 07:01 pm (UTC)
From: [identity profile] karlvonl.livejournal.com
Sorry, I didn't realize you could call methods on Java string literals. It's not something that's come up for me in practice.

Date: 2007-04-26 07:24 pm (UTC)
From: [identity profile] jaq.livejournal.com
Java 5 and 6 have autoboxing, which can implicitly convert between object and primitive types for numbers in some circumstances. But that doesn't extend to letting you call methods on literal numbers unfortunately.

Date: 2007-04-26 06:39 pm (UTC)
From: [identity profile] xach.livejournal.com
JavaScript and Smalltalk and Lisp all let you call methods on literals...

Date: 2007-04-26 06:35 pm (UTC)
ext_2472: (Default)
From: [identity profile] radiotelescope.livejournal.com
Python also has methods on literals. "hello".upper() returns "HELLO".

Mr. Grumpy

Date: 2007-04-26 10:52 pm (UTC)
From: [identity profile] taskboy3000.livejournal.com
Syntax is overrated.

There, I said it.

I write code to make money. Sure, I enjoy coding, but really, I like money more. The language feature that is important to me right now is: can I create a deployable application with it?

For desktop apps, Python and Java fit this need very, very nicely. For ASP apps, it's PHP or Perl for me.

Size matters. Ruby doesn't have the CPAN^Wlibrary repository or developer community that the other languages that were mentioned boast. It may some day. Ruby is a cool little language, but that's not all that important anymore. Great tech does not a product make.

Certainly, it is time to write the obitrary of Perl. It's a great language that's in maintenance mode now. Still useful, but it's golden years are over. Java is fighting to stay relevant. Without Sun chucking gobs of money at it, Java would have all but died by now. Without the healthy rivally of a vigorous Perl community, Python seems pretty much in maintenance mode too.

At least Ruby appears to have momentum, but where is it going? CGI/Templates/MVC isn't exactly cutting edge and continuations are syntactic sugar.

If I had to advise a new programmer, I steer them towards C++ or even .Net.
C++ is generally more useful but a complete in the balls to program. Even a little skill with .Net can net you a schelpy job in the bowels of corpamerica.

I'm a grumpy old man.

Re: Mr. Grumpy

Date: 2007-04-27 12:55 am (UTC)
From: [identity profile] radtea.livejournal.com

I was walking down the hall at a client's office the other day and commented to one of their engineers, "I'm old and cynical." A VP who was behind us, who's known me for years, piped up with, "I'm certainly not going to contradict you on that!" So I guess I count as a grumpy old man too.

About ten years ago I stopped learning new languages. I am guru-level with C++ (and FORTRAN, not that it matters anymore), pretty good with Perl, adequate with Java and Python and a few others. I resisted Python for a long time because maturity is the big value-add: I want to be able to dig up a lib to do any reasonable and most unreasonable tasks with a language. That's the only way it's worth my investment to learn the quirks.

So I'm a sworn enemy of all these languages like Ruby, Haskell and Lua, despite their growing popularity in many circles. Like you said, syntax is over-rated, which is why I like Perl: it doesn't have any! LIBRARIES are what make a language great, once it has reached a basic level of syntactical maturity.

No one would call Perl or C++ pretty, but they not only have the expressive power to do everything I could possibly want (and a good deal more than some maintenance programmers can handle) they also have really deep libraries, covering all the ground I need. There are very, very few things that someone hasn't already done in these languages, and I'm happy to exploit that store of past effort rather than waste my time reinventing the wheel.

So my advice to anyone who wants to learn a new language is to do it for fun if you want, but for production code a) stick to what you know and b) focus on what has the best, deepest, richest libs.

Date: 2007-04-28 08:40 am (UTC)
From: [identity profile] jaq.livejournal.com
Hmm, I'm not sure what it did to my comment.

It was supposed to be a link to this article which attempts to illustrate the difference syntax can make.

Date: 2007-04-29 02:14 pm (UTC)
From: [identity profile] radtea.livejournal.com

Yeah, syntax can make a difference. But a lot of syntax is a bad idea for two reasons: it lets programmers do things they probably shouldn't because it's "easy" (for them, not the maintenance coders) and it creates multiple ways of doing the same things, which requires the language-idiom-police to move in and enforce some standards.

GOTO's looked pretty cool once upon a time, and I'm pretty sure that closures (and anonymous inner classes) are not particularly good things to have in production code. Maintainability degrades when there is extreme decoupling between dependent objects and actions. When something blows up in the middle of an anonymous class that was created on the fly somewhere long ago in a constructor far far away the poor guy maintaining the app is in trouble.

So in the best Canadian fashion I am in favour of syntax if necessary, but not necessarily syntax.

August 2022

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
28 293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 19th, 2025 07:48 am
Powered by Dreamwidth Studios