[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

State of the Onion

M. Edward (Ed) Borasky

8/5/2008 2:05:00 AM

http://www.gcn.com/online/vol1_no1/46...

Just thought you'd like to know. ;)
--
M. Edward (Ed) Borasky
ruby-perspectives.blogspot.com

"A mathematician is a machine for turning coffee into theorems." --
Alfréd Rényi via Paul ErdÅ?s


33 Answers

Phlip

8/5/2008 2:41:00 AM

0

M. Edward (Ed) Borasky wrote:

> http://www.gcn.com/online/vol1_no1/46...
>
> Just thought you'd like to know. ;)

Larry Wall will cure cancer!!

"For power users of this open source language, such extensibility could mean
that they will be able to augment the language with instructions, syntax,
expressions, operators and other features to meet their own needs. An office of
the National Cancer Institute, for instance, could extend Perl to include
features that could aid in medical research."

Like they couldn't have just gone with "an automobile tire distributor could
extend Perl to include features that could aid in distributing tires"...

And - just think! - O'Reilly will let anyone into their little clich, if they
exhibit sufficient delusions of godhood.

Now excuse me while I get back to extending Ruby in application-specific ways...

--
Phlip
http://www.oreillynet.com/ruby/blog/2008/02/as...

M. Edward (Ed) Borasky

8/5/2008 2:59:00 AM

0

On Tue, 2008-08-05 at 11:43 +0900, Phlip wrote:
> M. Edward (Ed) Borasky wrote:
>
> > http://www.gcn.com/online/vol1_no1/46...
> >
> > Just thought you'd like to know. ;)
>
> Larry Wall will cure cancer!!
>
> "For power users of this open source language, such extensibility could mean
> that they will be able to augment the language with instructions, syntax,
> expressions, operators and other features to meet their own needs. An office of
> the National Cancer Institute, for instance, could extend Perl to include
> features that could aid in medical research."
>
> Like they couldn't have just gone with "an automobile tire distributor could
> extend Perl to include features that could aid in distributing tires"...
>
> And - just think! - O'Reilly will let anyone into their little clich, if they
> exhibit sufficient delusions of godhood.

My sediments exactly. "Version 6 of the Perl will be the first truly
extensible programming language, promised Perl creator Larry Wall". Uh
huh ... it won't be the first Turing complete language, it won't be the
first macro-rewriting language, it won't be the first language with
features to exploit concurrency, or vectorization, etc. And it won't be
Perl, either. :)

>
> Now excuse me while I get back to extending Ruby in application-specific ways...

Well ... OK ... just don't expect Larry Wall to care. ;)
>
--
M. Edward (Ed) Borasky
ruby-perspectives.blogspot.com

"A mathematician is a machine for turning coffee into theorems." --
Alfréd Rényi via Paul ErdÅ?s


David Masover

8/5/2008 3:04:00 AM

0

On Monday 04 August 2008 21:43:35 Phlip wrote:

> Now excuse me while I get back to extending Ruby in application-specific
ways...

Ruby is, indeed, the best way to do that now. And Perl6 has been coming for,
what, eight years? I'm not holding my breath...

That said, if I understand this, it would involve actual changes to the
parser. Can't really do that in Ruby -- or at least, not without recompiling
Ruby.

Has anyone actually done the equivalent of Acme::Lingua::Pirate::Perl for
Ruby? If so, how much work was it? How hackish was it?

Gregory Brown

8/5/2008 3:08:00 AM

0

On Mon, Aug 4, 2008 at 11:03 PM, David Masover <ninja@slaphack.com> wrote:

> Has anyone actually done the equivalent of Acme::Lingua::Pirate::Perl for
> Ruby? If so, how much work was it? How hackish was it?

http://code.stonecode....

Enjoy :)

-geg

Gregory Brown

8/5/2008 3:14:00 AM

0

On Mon, Aug 4, 2008 at 11:09 PM, Gregory Brown
<gregory.t.brown@gmail.com> wrote:
> On Mon, Aug 4, 2008 at 11:03 PM, David Masover <ninja@slaphack.com> wrote:
>
>> Has anyone actually done the equivalent of Acme::Lingua::Pirate::Perl for
>> Ruby? If so, how much work was it? How hackish was it?
>
> http://code.stonecode....

Oh, to be fair, this doesn't really work the way Lingua does, because
it doesn't really modify syntax. But... it does bring pirate joy to
Ruby. ;)

Daniel Berger

8/5/2008 3:26:00 AM

0

David Masover wrote:
> On Monday 04 August 2008 21:43:35 Phlip wrote:
>
>> Now excuse me while I get back to extending Ruby in application-specific
> ways...
>
> Ruby is, indeed, the best way to do that now. And Perl6 has been coming for,
> what, eight years? I'm not holding my breath...
>
> That said, if I understand this, it would involve actual changes to the
> parser. Can't really do that in Ruby -- or at least, not without recompiling
> Ruby.

Can you say "Job Security" boys and girls?

Yes, I thought you could.

Dan


Michael T. Richter

8/5/2008 3:48:00 AM

0

[Note: parts of this message were removed to make it a legal post.]

On Tue, 2008-08-05 at 11:05 +0900, M. Edward (Ed) Borasky wrote:

> http://www.gcn.com/online/vol1_no1/46...
> Just thought you'd like to know. ;)


So Larry Wall has reinvented Lisp without Lisp's minimalist elegance?
Dylan did it first, but at least it had the decency to call itself a
Lisp dialect.

Greenspun was proven right. Again.


> Any sufficiently complicated C or Fortran program contains an ad hoc,
> informally-specified, bug-ridden, slow implementation of half of
> Common Lisp.


--
Michael T. Richter <ttmrichter@gmail.com> (GoogleTalk:
ttmrichter@gmail.com)
When debugging, novices insert corrective code; experts remove defective
code. (Richard Pattis)

Clifford Heath

8/5/2008 3:59:00 AM

0

David Masover wrote:
> Has anyone actually done the equivalent of Acme::Lingua::Pirate::Perl for
> Ruby? If so, how much work was it? How hackish was it?

I'm not familiar with Acme::..., but the right answer for Ruby
is to use a composable grammar for its compiler (such as, but
not necessarily, the ones emitted by Treetop), and then to
simply support the "grammar" block ala Treetop where you can
define new syntax rules. Any time a new grammar rule fires,
the syntax may include as much or as little of the general
Ruby syntax as the rules decide to call. When a grammar rule
replaces a built-in one, it's able to use "super" to call the
original rule, as in Treetop... If you can also associate a
grammar rule as thej top rule of a filetype extension for a
file loaded from require (the way my Polyglot gem does), you
can require files in any language for which you have a grammar.

This is an amazingly powerful concept... someone will do it
sooner or later.

Clifford Heath.

David Masover

8/5/2008 4:49:00 AM

0

On Monday 04 August 2008 22:25:35 Daniel Berger wrote:

> Can you say "Job Security" boys and girls?

Ruby is already flexible enough to cause that problem -- or have that benefit,
depending on your point of view.

There just seems to be a general consensus that DSLs can work, if used
judiciously. No one seems to have a problem with, say, Sinatra:

get '/' do
'Hello, world!'
end

The only change here, I think, is that we can now do things like:

get /
'Hello, world!'
end

Or, for the more Python-inclined, drop the 'end'. And that's a very basic
example -- wouldn't it be nice if, when configured to use Haml as a
templating language, we could do:

get /
%h1.greeting
Hello, world!

Ok, probably a bad idea to make this the default, as in this example, but you
get the idea. Markaby is a cool concept, but at the end of the day, Haml just
feels cleaner. It also makes the point for very tightly-defined DSLs with
very odd syntax -- and this happens anyway, with Haml, whether or not Ruby
makes it easy.

I do see a point for Ruby's approach, though, in that I can get reliable
editor coloring, and I can, at a glance, and without reading documentation,
have an indication of what's going on -- at which things are part of the app,
which are part of the framework, and which are part of the language.

David Masover

8/5/2008 4:58:00 AM

0

On Monday 04 August 2008 22:58:36 Clifford Heath wrote:

> I'm not familiar with Acme::...

For what it's worth, this isn't really about Acme, it's just the best example
I could think of for Lingua, which can munge syntax (somewhat).

Acme is actually a Perl library for "fun" stuff, most of which is just silly,
but sometimes, they do sort of serve as an example of whatever they're
demonstrating. The two that I've noticed:

Acme::Lingua::Pirate::Perl -- you can write Perl in the Pirate language
Acme::POE::Knee -- ponie races written for POE, the Perl Object Environment
(similar, I'd guess, to eventmachine)

Of course, you'll find all sorts of stuff. Usually high quality,
well-documented, and mostly useless:

use Acme::Drunk;

my $bac = drunk(
gender => MALE, # or FEMALE
hours => 2, # since start of binge
body_weight => 160, # in lbs
alcohol_weight => 3, # oz of alcohol
);

$bac >= 0.08 ? call_cab() : walk_home();