ruby-dev summary 21637-21729

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default ruby-dev summary 21637-21729

    Hello,

    I present you a summary of the ruby-dev mailing list.

    [ruby-dev:21639] load() blocks thread scheduling
    Tietew posted the following scripts which didn't timeout and didn't
    accept Ctrl+C.

    -- main.rb --
    require 'timeout'
    timeout(60) { load 'block.rb' }

    --- block.rb
    loop { }

    He also posted a patch to change the thread. Matz wrote that
    it would cause unexpected troubles if we didn't block other
    thread while loading a script.


    [ruby-dev:21641] SOAP::StreamError: Illegal media type
    SOAP4R's test suite failed since it required pre-installed SOAP4R
    library. Matz suggested that the test suite in ruby should use
    not pre-installed libraries but use archived new libraries from
    the archive.


    [ruby-dev:21678] Problems of testing test/drb on Windows
    U. Nakamura showed two opinions about test/drb on Windows as follows.
    (a) test/drb/test_drbunix.rb failed if it was executed via
    test/runner.rb, since Windows didn't have Socket::UNIX*.
    He thought that such error had better occur when loading
    'drb/unix'.
    (b) The result of test/drb/test_acl.rb was 'E', since the
    ruby was compiled without AF_INET6 and IPAddr#ipv6?
    caused NameError. He proposed some solutions to avoid
    NameError.


    [ruby-dev:21679] Proposal: string literal concatenation
    Mput proposed a specification which enables us to concatenate
    strings using a new line like the following script.

    s = "foo1" "bar1"
    "foo2" "bar2"

    Matz answered that he will discard string literal concatenation.


    [ruby-dev:21682] ruby-tk hangs when exception is raised

    Akira Yamada received a bug report as a package maintainer of
    Debian. The following Ruby/TK script caused a problem that
    Ctrl+C was not available. This problem have not been solved yet.

    require 'tk'
    r = TkRoot.new
    b = TkButton.new(r) { text "break me" }
    b.command proc {
    raise "error!"
    }
    b.pack
    Tk.mainloop

    --
    Takaaki Tateishi <ttate@ttsky.net>

    Takaaki Tateishi Guest

  2. Similar Questions and Discussions

    1. ruby-dev summary 21833-21882
      Hello, This is a summary of ruby-dev mailing list last week. lib/test/unit/ui/tk/testrunner.rb A new GUI interface for lib/test/unit...
    2. [ANN] ruby-dev summary index
      Hi all, I made the index page of ruby-dev summary: http://i.loveruby.net/en/ruby-dev-summary.html This page is going to be updated on every...
    3. ruby-dev summary 21531-21607
      Hello all, This is a summary of ruby-dev mailing list. O_ACCMODE Tanaka Akira added a constant Fcntl::O_ACCMODE defined in POSIX fcntl.h...
    4. ruby-dev summary 21295-21366
      Hi all, This is a summary of ruby-dev ML in these days. test and sample directory NAKAMURA Hiroshi suggested to locate tests and examples...
    5. ruby-dev summary 20519-20714
      Hello, all. Recently, I'm working on BigDecimal. My main purpose is not to extend it, but to be become friendly with other numerical classes. ...
  3. #2

    Default Re: ruby-dev summary 21637-21729

    On Fri, Oct 31, 2003 at 07:01:28AM +0900, Takaaki Tateishi wrote:
    > [ruby-dev:21679] Proposal: string literal concatenation
    > Mput proposed a specification which enables us to concatenate
    > strings using a new line like the following script.
    >
    > s = "foo1" "bar1"
    > "foo2" "bar2"
    >
    > Matz answered that he will discard string literal concatenation.
    So what will the result of the above two lines of code be?

    Paul


    Paul Brannan Guest

  4. #3

    Default Re: ruby-dev summary 21637-21729

    Hi,

    In message "Re: ruby-dev summary 21637-21729"
    on 03/11/06, Paul Brannan <pbrannan@atdesk.com> writes:

    |On Fri, Oct 31, 2003 at 07:01:28AM +0900, Takaaki Tateishi wrote:
    |> [ruby-dev:21679] Proposal: string literal concatenation
    |> Mput proposed a specification which enables us to concatenate
    |> strings using a new line like the following script.
    |>
    |> s = "foo1" "bar1"
    |> "foo2" "bar2"
    |>
    |> Matz answered that he will discard string literal concatenation.
    |
    |So what will the result of the above two lines of code be?

    Plain syntax error in 1.9.x.

    matz.

    Yukihiro Matsumoto Guest

  5. #4

    Default Re: ruby-dev summary 21637-21729

    On Thu, Nov 06, 2003 at 11:17:59PM +0900, Yukihiro Matsumoto wrote:
    > In message "Re: ruby-dev summary 21637-21729"
    > on 03/11/06, Paul Brannan <pbrannan@atdesk.com> writes:
    > |So what will the result of the above two lines of code be?
    >
    > Plain syntax error in 1.9.x.
    Is the syntax error because of the first line or because of the second?
    I ask because I do this a lot in my code:

    s = "this is a string " \
    "that I have chosen to break " \
    "into multiple lines

    I would be happy to switch to using heredocs if there were an easy way
    to indent heredocs.

    Paul


    Paul Brannan Guest

  6. #5

    Default Re: ruby-dev summary 21637-21729

    Hi,

    In message "Re: ruby-dev summary 21637-21729"
    on 03/11/06, Paul Brannan <pbrannan@atdesk.com> writes:

    |Is the syntax error because of the first line or because of the second?

    Both. Sequence of strings will no longer be valid.

    |I ask because I do this a lot in my code:
    |
    | s = "this is a string " \
    | "that I have chosen to break " \
    | "into multiple lines"

    How about

    s = "this is a string " +
    "that I have chosen to break " +
    "into multiple lines"
    ?

    matz.

    Yukihiro Matsumoto Guest

  7. #6

    Default Re: ruby-dev summary 21637-21729

    On Fri, Nov 07, 2003 at 12:36:23AM +0900, Yukihiro Matsumoto wrote:
    > In message "Re: ruby-dev summary 21637-21729"
    > on 03/11/06, Paul Brannan <pbrannan@atdesk.com> writes:
    > |
    > | s = "this is a string " \
    > | "that I have chosen to break " \
    > | "into multiple lines"
    >
    > How about
    >
    > s = "this is a string " +
    > "that I have chosen to break " +
    > "into multiple lines"
    This works, but the concatenation is done at run-time instead of at
    compile-time.

    Paul


    Paul Brannan Guest

  8. #7

    Default Re: ruby-dev summary 21637-21729

    On Fri, Nov 07, 2003 at 07:57:32AM +0900, Paul Brannan quipped:
    > > How about
    > >
    > > s = "this is a string " +
    > > "that I have chosen to break " +
    > > "into multiple lines"
    >
    > This works, but the concatenation is done at run-time instead of at
    > compile-time.
    Or so you assume. I don't know how Matz will handle this, but there's
    no reason concatenation of string constants could not be done at
    compile time.

    Robert Church Guest

  9. #8

    Default Re: ruby-dev summary 21637-21729

    --9Q2l3mYpK16UQ/iv
    Content-Type: text/plain; charset=us-ascii
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable

    Robert Church (rc@pgdn.org) wrote:
    > On Fri, Nov 07, 2003 at 07:57:32AM +0900, Paul Brannan quipped:
    > > > How about
    > > >=20
    > > > s =3D "this is a string " +
    > > > "that I have chosen to break " +
    > > > "into multiple lines"
    > >=20
    > > This works, but the concatenation is done at run-time instead of at
    > > compile-time.
    >=20
    > Or so you assume. I don't know how Matz will handle this, but there's
    > no reason concatenation of string constants could not be done at
    > compile time.
    You can redefine String#+, so no such optimization must be made at
    compile time.

    --=20
    Eric Hodel - [email]drbrain@segment7.net[/email] - [url]http://segment7.net[/url]
    All messages signed with fingerprint:
    FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04


    --9Q2l3mYpK16UQ/iv
    Content-Type: application/pgp-signature
    Content-Disposition: inline

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (FreeBSD)

    iD8DBQE/qtVWMypVHHlsnwQRAtPlAJ9DCuzf1TwhCsALULpNe8/BK3PC/gCcCjhw
    gBjJP9ZU9QLi6bD30tO9TgA=
    =LqSQ
    -----END PGP SIGNATURE-----

    --9Q2l3mYpK16UQ/iv--

    Eric Hodel Guest

  10. #9

    Default Re: ruby-dev summary 21637-21729

    il Fri, 7 Nov 2003 07:57:32 +0900, Paul Brannan <pbrannan@atdesk.com>
    ha scritto::

    >This works, but the concatenation is done at run-time instead of at
    >compile-time.
    well, this could be meaningful if ruby had a real compiling fase.
    And if it had it this could be esailt solved from the compiler (I
    think javac does this, for example)
    gabriele renzi Guest

  11. #10

    Default Re: ruby-dev summary 21637-21729

    On Thursday 06 November 2003 07:36 am, Yukihiro Matsumoto wrote:
    > Hi,
    >
    > In message "Re: ruby-dev summary 21637-21729"
    >
    > on 03/11/06, Paul Brannan <pbrannan@atdesk.com> writes:
    > |Is the syntax error because of the first line or because of the second?
    >
    > Both. Sequence of strings will no longer be valid.
    >
    > |I ask because I do this a lot in my code:
    > |
    > | s = "this is a string " \
    > | "that I have chosen to break " \
    > | "into multiple lines"
    >
    > How about
    >
    > s = "this is a string " +
    > "that I have chosen to break " +
    > "into multiple lines"
    > ?
    My 1 cent: I really wish "" \ style concatenation wouldn't go away.

    Sean O'Dell


    Sean O'Dell Guest

  12. #11

    Default Re: ruby-dev summary 21637-21729

    Hi,

    At Fri, 7 Nov 2003 07:57:32 +0900,
    Paul Brannan wrote:
    > On Fri, Nov 07, 2003 at 12:36:23AM +0900, Yukihiro Matsumoto wrote:
    > > In message "Re: ruby-dev summary 21637-21729"
    > > on 03/11/06, Paul Brannan <pbrannan@atdesk.com> writes:
    > > |
    > > | s = "this is a string " \
    > > | "that I have chosen to break " \
    > > | "into multiple lines"
    > >
    > > How about
    > >
    > > s = "this is a string " +
    > > "that I have chosen to break " +
    > > "into multiple lines"
    >
    > This works, but the concatenation is done at run-time instead of at
    > compile-time.
    In 1.8, this is concatenated at compile-time. :)

    s = "this is a string #{ # And you can write
    ""}that I have chosen to break #{ # comments!
    ""}into multiple lines"

    --
    Nobu Nakada

    nobu.nokada@softhome.net Guest

  13. #12

    Default Re: ruby-dev summary 21637-21729

    [email]nobu.nokada@softhome.net[/email] wrote:
    > In 1.8, this is concatenated at compile-time. :)
    >
    > s = "this is a string #{ # And you can write
    > ""}that I have chosen to break #{ # comments!
    > ""}into multiple lines"
    >
    Very cool! It doesn't need the "", though, does it?

    irb(main):001:0> "foo#{
    irb(main):002:0" }bar"
    => "foobar"


    Joel VanderWerf Guest

  14. #13

    Default Re: ruby-dev summary 21637-21729

    Hi,

    At Fri, 7 Nov 2003 10:42:51 +0900,
    Joel VanderWerf wrote:
    > > In 1.8, this is concatenated at compile-time. :)
    > >
    > > s = "this is a string #{ # And you can write
    > > ""}that I have chosen to break #{ # comments!
    > > ""}into multiple lines"
    > >
    >
    > Very cool! It doesn't need the "", though, does it?
    >
    > irb(main):001:0> "foo#{
    > irb(main):002:0" }bar"
    > => "foobar"
    It needs for compile-time concatenation, because nil.to_s might
    be replaced.

    $ ruby -rNodeDump -e '"foo#{' -e '}bar"'
    NodeDump V0.9

    NODE_NEWLINE: [-e:1]
    NODE_DSTR: "foo"
    NODE_EVSTR:
    NODE_STR: "bar"

    $ ruby -rNodeDump -e '"foo#{' -e '""}bar"'
    NodeDump V0.9

    NODE_NEWLINE: [-e:1]
    NODE_STR: "foobar"

    This optimization is limited to the case #{} ends with a
    literal string (and preceding literals without any side
    effects)

    --
    Nobu Nakada

    nobu.nokada@softhome.net Guest

  15. #14

    Default Re: ruby-dev summary 21637-21729

    Hi,

    In message "Re: ruby-dev summary 21637-21729"
    on 03/11/07, Paul Brannan <pbrannan@atdesk.com> writes:

    |This works, but the concatenation is done at run-time instead of at
    |compile-time.

    Don't worry. It's done at run-time anyway.

    matz.

    Yukihiro Matsumoto Guest

  16. #15

    Default Re: ruby-dev summary 21637-21729

    Hi,

    In message "Re: ruby-dev summary 21637-21729"
    on 03/11/07, "Sean O'Dell" <sean@celsoft.com> writes:

    |My 1 cent: I really wish "" \ style concatenation wouldn't go away.

    Why?

    matz.

    Yukihiro Matsumoto Guest

  17. #16

    Default Re: ruby-dev summary 21637-21729

    Hi,

    Yukihiro Matsumoto wrote:
    > Hi,
    >
    > In message "Re: ruby-dev summary 21637-21729"
    > on 03/11/06, Paul Brannan <pbrannan@atdesk.com> writes:
    >
    > |Is the syntax error because of the first line or because of the second?
    >
    > Both. Sequence of strings will no longer be valid.
    >
    > |I ask because I do this a lot in my code:
    > |
    > | s = "this is a string " \
    > | "that I have chosen to break " \
    > | "into multiple lines"
    >
    > How about
    >
    > s = "this is a string " +
    > "that I have chosen to break " +
    > "into multiple lines"
    I would prefer this:

    s = "this is a string "
    + "that I have chosen to break "
    + "into multiple lines"

    I think it's always better to avoid operators in the end of lines (code
    is therefore more readeable).

    Same think for this:

    if ( expr1...
    and expr2...
    and expr3... )

    # do something
    end

    But AFAIK && unfortunately, Ruby does not handle this kind of syntax yet.

    Matz, what do you think about this?

    Thanks,

    --
    Laurent

    Laurent Sansonetti Guest

  18. #17

    Default Re: ruby-dev summary 21637-21729

    On Fri, Nov 07, 2003 at 06:04:47PM +0900, Laurent Sansonetti wrote:
    > I think it's always better to avoid operators in the end of lines (code
    > is therefore more readeable).
    >
    > But AFAIK && unfortunately, Ruby does not handle this kind of syntax yet.
    Because of Ruby's line-based syntax, Ruby guesses that if you have hit
    the end of the line and the line as a whole is valid, then you have
    finished that statement. This is essentially a limitation of the parser.
    There are two ways around this - require statements to end with a
    special character (eg a semicolon) so that if we get to the end of the
    line and haven't found that character yet we know the statement isn't
    finished, or implement look-ahead in the parser to take a look at the
    next line and see if it, when combined with the current line, is a valid
    statement as a whole. This is a lot more difficult; it involves
    look-ahead and creates a whole new family of ambiguities; e.g. what do
    you do if the next line creates a valid statement when combined with
    this line, and also the two lines are valid statements by themselves? So
    if the alternative is to require every statement to end in a semicolon
    (noooo!) which takes a significant chunk out of the beauty of the
    language, I must say that I prefer the way it is done now - and the same
    applies to most of Matz's decisions, which is why I love this language.

    Tim Bates
    --
    [email]tim@bates.id.au[/email]

    Tim Bates Guest

  19. #18

    Default Re: ruby-dev summary 21637-21729


    In message "Re: ruby-dev summary 21637-21729"
    on 03/11/07, Laurent Sansonetti <laurent@datarescue.be> writes:

    |I would prefer this:
    |
    |s = "this is a string "
    | + "that I have chosen to break "
    | + "into multiple lines"
    |
    |I think it's always better to avoid operators in the end of lines (code
    |is therefore more readeable).
    |
    |Same think for this:
    |
    |if ( expr1...
    | and expr2...
    | and expr3... )
    |
    | # do something
    |end
    |
    |But AFAIK && unfortunately, Ruby does not handle this kind of syntax yet.
    |
    |Matz, what do you think about this?

    There's always trade-off. Newline sensitive syntax do not allow
    line concatenation by operator at the beginning of a line, e.g. how
    can we distinguish

    s = "this is a string "
    + "that I have chosen to break "
    + "into multiple lines"

    which is a single assignment statement, from

    s = "this is a string "
    + "that I have chosen to break "
    + "into multiple lines"

    an assignment followed by two unary plus expression?

    matz.

    Yukihiro Matsumoto Guest

  20. #19

    Default Re: ruby-dev summary 21637-21729

    > > | s = "this is a string " \
    > > | "that I have chosen to break " \
    > > | "into multiple lines"
    > >
    > > How about
    > >
    > > s = "this is a string " +
    > > "that I have chosen to break " +
    > > "into multiple lines"
    >
    > I would prefer this:
    >
    > s = "this is a string "
    > + "that I have chosen to break "
    > + "into multiple lines"
    shades of %L and kin

    T. Onoma Guest

  21. #20

    Default Re: ruby-dev summary 21637-21729

    > > Both. Sequence of strings will no longer be valid.
    > >
    > > |I ask because I do this a lot in my code:
    > > |
    > > | s = "this is a string " \
    > > | "that I have chosen to break " \
    > > | "into multiple lines"
    how will this 'fect HERE docs?

    print <<HERE
    Double quoted \
    here document.
    HERE


    T. Onoma 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