Ask a Question related to Ruby, Design and Development.

  1. #1

    Default def

    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)

    -t0

    T. Onoma Guest

  2. #2

    Default Re: def

    il Sat, 15 Nov 2003 20:11:13 +0900, "T. Onoma" <transami@runbox.com>
    ha scritto::
    >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?
    a keyword?
    well, btw it is also sugar fore define_method() :)
    >(funny we say def for define but not init for initialize)
    I would have loved init :(

    sidenote: what about that old thread about making def return something
    useful ? (I remember that an UnboundMethod was refused, but what about
    a Symbol? )
    gabriele renzi Guest

  3. #3

    Default Re: def

    T. Onoma wrote:
    > 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)
    >
    > -t0
    >
    It is a special form. Or, to paraphrase the Gateless Gate,

    A monk asked Nansen: `Is there a teaching no master ever preached before?'

    Nansen said: `Yes, there is.'

    `What is it?' asked the monk.

    Nansen replied: `It is not a method, it is not some sugar, it is not
    lambda.'

    ([url]http://www.ibiblio.org/zen/gateless-gate/27.html[/url])


    Joel VanderWerf Guest

  4. #4

    Default Re: def

    On Sat, 15 Nov 2003, T. Onoma wrote:

    # what is this def?

    A keyword

    # it is not a method...?

    No.

    # it is not some sugar...?

    Sort of. (But you could say that pretty much everything in modern
    languages is sugar).

    # well might it be a lambda...?

    No.

    # just what is this def?
    #

    See above.

    # (funny we say def for define but not init for initialize)
    #

    Not really.



    Chad Fowler Guest

  5. #5

    Default Re: def

    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)

    T. Onoma Guest

  6. #6

    Default Chromeless Windows EXE

    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!


    Rich Guest

  7. #7

    Default Re: def

    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

    [url]http://www.rubygarden.org/article.php?sid=294[/url]


    --
    _ _
    | |__ __ _| |_ ___ _ __ ___ __ _ _ __
    | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
    | |_) | (_| | |_\__ \ | | | | | (_| | | | |
    |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
    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

    Mauricio Fernández Guest

  8. #8

    Default Re: def

    Moin!

    Mauricio Fernández wrote:
    > [url]http://www.rubygarden.org/article.php?sid=294[/url]
    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


    Florian Gross Guest

  9. #9

    Default Re: def

    il Sun, 16 Nov 2003 06:11:34 +0900, Florian Gross <flgr@ccan.de> ha
    scritto::
    >Moin!
    >
    >Mauricio Fernández wrote:
    >
    >> [url]http://www.rubygarden.org/article.php?sid=294[/url]
    >
    btw even:
    [url]http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/15434[/url]

    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.
    gabriele renzi Guest

  10. #10

    Default Re: def

    Hi!

    * Chad Fowler; 2003-11-15, 21:03 UTC:
    > On Sat, 15 Nov 2003, T. Onoma wrote:
    > # it is not a method...?
    >
    > No.
    Just for clarification: That is "no" as in "No, it really isn't", not
    "no" as in "No, that is wrong" (which it to my knowledge would mean
    in Japanese).

    Josef 'Jupp' Schugt
    --
    .-------.
    message > 100 kB? / | |
    sender = spammer? / | R.I.P.|
    text = spam? / ___| |___

    Josef 'Jupp' SCHUGT Guest

  11. #11

    Default Re: def

    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 [email]jweirich@one.net[/email] [url]http://onestepback.org[/url]
    -----------------------------------------------------------------
    "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)



    Jim Weirich Guest

  12. #12

    Default Re: def

    gabriele renzi wrote:
    > I would have loved init :(
    >
    I'm thinking that Ruby should accept any method that is a one-character
    misspelling of initialize as an initializer. Perhaps I'll write an RCR.

    --
    -- Jim Weirich [email]jweirich@one.net[/email] [url]http://onestepback.org[/url]
    -----------------------------------------------------------------
    "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)



    Jim Weirich Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139