[lnkForumImage]
TotalShareware - Download Free Software

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


 

T. Onoma

11/15/2003 6:03:00 PM

i ask b/c i was thinking it would be good if def actually returned a value, i.e. the symbol of the method being defined.

def foo # => :foo
...
end

why?

private def foo
...
end

instead of having to do seperated way.

-t0


> what is this def?
> it is not a method...?
> it is not some sugar...?
> well might it be a lambda...?
> just what is this def?
>
> (funny we say def for define but not init for initialize)


5 Answers

Rich

11/15/2003 6:12:00 PM

0

I can already open my EXE from Ruby using:

IO.popen("gui.exe")

I'm hoping that I can remove the chrome from that EXE before I run it...

... either at runtime with some command or option...

... or before I run it if there's some place in the binary file I can change
something...

... it might even be ok if I had to embed the exe in some other exe... as
long as I could still give everything to the client in 'one exe'...

... is there a simple way?

Thanks!

-Rich
P.s. - I'm really, really clueless about any serious programming, so please
go easy on me if it's simple... thanks!


Mauricio Fernández

11/15/2003 7:08:00 PM

0

On Sun, Nov 16, 2003 at 03:02:41AM +0900, T. Onoma wrote:
> i ask b/c i was thinking it would be good if def actually returned a value, i.e. the symbol of the method being defined.
>
> def foo # => :foo
> ...
> end
>
> why?
>
> private def foo
> ...
> end

heh

http://www.rubygarden.org/article.p...


--
_ _
| |__ __ _| |_ ___ _ __ ___ __ _ _ __
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

Not only Guinness - Linux is good for you, too.
-- Banzai on IRC

Florian Gross

11/15/2003 9:12:00 PM

0

Moin!

Mauricio Fernández wrote:

> http://www.rubygarden.org/article.p...

I did some more thinking on my initial suggestion and came to the
conclusion that def should return a Method which like all other Methods
should have a #to_sym.

It sure would be nice to know what matz thinks about all of this!

Regards,
Florian Gross


gabriele renzi

11/16/2003 9:41:00 AM

0

il Sun, 16 Nov 2003 06:11:34 +0900, Florian Gross <flgr@ccan.de> ha
scritto::

>Moin!
>
>Mauricio Fernández wrote:
>
>> http://www.rubygarden.org/article.p...
>
btw even:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-...

the last message from matz was

-------
>> Shugo Maeda once proposed making "def" to return symbol name of the
>> defined method.

>Yup: that would work very nicely too.
>
>So, do we have an RCR?

Yes. Would you add it, Mike? Or Dave?
matz.

Jim Weirich

11/17/2003 6:56:00 PM

0

Florian Gross wrote:

> I did some more thinking on my initial suggestion and came to the
> conclusion that def should return a Method which like all other Methods
> should have a #to_sym.
>
> It sure would be nice to know what matz thinks about all of this!

In the RubyConf keynote talk, Matz indicated that Ruby 2.0 would return
/something/ from a def. I don't recall if he was specific about what
that something was.

--
-- Jim Weirich jweirich@one.net http://onest...
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)