PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > porting Shoes to Ruby1.9 is fun, and illustrates how Ruby emerged "named optional arguments"
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
porting Shoes to Ruby1.9 is fun, and illustrates how Ruby emerged "named optional arguments"

Réponse
 
LinkBack Outils de la discussion
Vieux 31/03/2008, 04h57   #1
Phlip
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut porting Shoes to Ruby1.9 is fun, and illustrates how Ruby emerged "named optional arguments"

Ruboids:

I figured Doctor Why's eloquent Shoes project would look even better under
Ruby 1.9, so I recompiled it there.

(Note to those who should hope to keep their C extensions portable:
RSTRING(str)->ptr should be RSTRING_PTR(str). Other than that, it's a credit
to both _why and the Matz Faction that Why's code had no other C syntax
errors. We'll keep PLATFORM for RUBY_PLATFORM our little secret.

I'm here for some nice syntactic sugar that makes highly optional GUI
systems, such as Rails or Shoes, much easier on the fingers. This...

oval :left => x, :top => y, :radius => i, :center => true

....becomes this:

oval left: x, top: y, radius: i, center: true

That looks kind'a slick, huh? It reminds us of certain other languages that
provide "named optional parameters". Maybe those languages are still better
than Ruby - in that feature - because they didn't need to retrofit support
for it, huh?

The problem with those languages is they provide that feature using "magic".
They parse method calls differently from other statements. The problem with
"magic" in a language syntax is simple. Everything the language can do, a
programmer should be able to do, the same way. Here's a method definition
from a language that added named optional parameters at the parser level:

def info(object, spacing=10, collapse=1):

Call that with info(odbcer, collapse=0), for example. The problem with
this language is you can't do what the language does. You don't have the
option to manipulate hashes of symbols as named optional arguments, and vice
versa. Ruby will soon catch up to other languages, and we did it via
emergent design, not planned design.

Props, Matz!

--
Phlip


  Réponse avec citation
Vieux 31/03/2008, 05h14   #2
Phlip
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: porting Shoes to Ruby1.9 is fun, and illustrates how Ruby emerged "named optional arguments"

Someone replied:

> FAIK, PLATFORM is there since a long ago (1.8.6 and 1.8.5 have it).
>
> I just used to look for RUBY_PLATFORM ;-)


PLATFORM ain't there no more - good riddance. Everything in Ruby about Ruby
should start with rb or RUBY_. "Registered Package Prefix."

> Yeah, great things for 1.9 and Shoes!
>
> I only wish Shoes can be used without being a "wrap" around the
> interpreter and can be usable as a extension.
>
> But I know _why is creating Shows for HacketyHack, so I will not
> scream for it (too much) :-D


But that's just the thing. Ruby makes extensions so danged easy that you can
probably just jump into whatever main() calls, and rb_require the shoes.rb
wrappers in...

--
Phlip


  Réponse avec citation
Vieux 31/03/2008, 05h19   #3
Luis Lavena
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: porting Shoes to Ruby1.9 is fun, and illustrates how Ruby emerged"named optional arguments"

On Mar 31, 1:14 am, "Phlip" <phlip2...@gmail.com> wrote:
> Someone replied:
>
> > FAIK, PLATFORM is there since a long ago (1.8.6 and 1.8.5 have it).

>
> > I just used to look for RUBY_PLATFORM ;-)

>
> PLATFORM ain't there no more - good riddance. Everything in Ruby about Ruby
> should start with rb or RUBY_. "Registered Package Prefix."
>


Was Google groups and keyboard shortcuts fault! ;-)

Nice I've been using RUBY_PLATFORM since long time ago :-D

> > Yeah, great things for 1.9 and Shoes!

>
> > I only wish Shoes can be used without being a "wrap" around the
> > interpreter and can be usable as a extension.

>
> > But I know _why is creating Shows for HacketyHack, so I will not
> > scream for it (too much) :-D

>
> But that's just the thing. Ruby makes extensions so danged easy that you can
> probably just jump into whatever main() calls, and rb_require the shoes.rb
> wrappers in...
>


Yeah, creating extensions isn't complex, but can get tricky manage the
resources and memory allocation... :-P

Anyway, just a wish, don't have enough time to do it right now :-D

Regards,
--
Luis Lavena
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h42.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09357 seconds with 11 queries