Movatterモバイル変換


[0]ホーム

URL:


Whither SmallScript? (was Re: Integer micro-benchmarks)

Andrew Huntandy at toolshed.com
Fri Apr 27 13:27:07 EDT 2001


On Fri, 27 Apr 2001 16:33:05 GMT, Steve  Holden <sholden at holdenweb.com> wrote:>> Personally I found it quite interesting that SmallTalkers also see postings> advocating Ruby, and I know that some Pythonistas are quite interested in> it.Some Perl folk too.  And that's as it should be; use the right tool forthe job regardless of dogma.> I looked at Ruby, briefly, and didn't really like the flavor as much as> Python. Unless I'm thinking of another language altogether the syntax is> warty, with a Perl-ish use of punctuation which might make programs shorter,> but doesn't help with comprehension.Umm, that's not *quite* right.  It does happen to have some Perl-likeshortcuts, but I view those as training wheels for folks coming to Rubyfrom Perl.I personally like the style and dynacism of Ruby.  For instance, to declarea class that inherits from another class you simply have:class Foo < Bardef myMethodFile.new ("test.dat", "w") { |f| f.puts "Hello world!"}endendHere, class Foo inherits from class Bar.  Except that class Bar is just anexpression that returns a Class object.  In this case it's a constant, butyou could just as easily have:class Foo < someMagicRoutine(someArgument, somethingElse)File is a real object, we'll call open on it.  The opened file object ispassed to the block as local variable f, where we can call puts (named asin libc) to put a string to the file.  At the conclusion of the block,the file is closed automatically.Doesn't look much like Perl to me.  Oh, and that's just one way to use files -- you don't have to use them in a block, but I find ithandy to make sure I've really closed a file :-)/\ndy--Andrew Hunt, The Pragmatic Programmers, LLC.Innovative Object-Oriented Software Developmentweb:http://www.pragmaticprogrammer.com   email:andy at pragmaticprogrammer.com--Books by Andrew Hunt and David Thomas:    "The Pragmatic Programmer" (Addison-Wesley 2000)    "Programming Ruby" (Addison-Wesley 2001)--


More information about the Python-listmailing list

[8]ページ先頭

©2009-2025 Movatter.jp