Loading ...
Sorry, an error occurred while loading the content.

Re: Empty Creators / Bracket expressions

Expand Messages
  • James
    ... To add my 2c to this: Instead of treating newlines as separators always, it could work to disallow newlines between a function/procedure identifier and the
    Message 1 of 10 , Jan 2, 2010
    • 0 Attachment
      Martin Piskernig wrote:
      >> I too wish that newline would be a separators like ";" is.

      Eric Bezault wrote:
      > It would break code where long instructions are cut in two or more
      > lines.

      To add my 2c to this:

      Instead of treating newlines as separators always, it could work to disallow newlines between a function/procedure identifier and the following opening bracket, so that a newline gets treated as a separator if it occurs between a feature identifier and an opening bracket (in addition to requiring semicolons between multiple statements on the same line). It's probably pretty common to split statements over several lines, but I think it's pretty rare to use any whitespace at all between a function/procedure identifier and the following opening bracket, let alone a newline. Unfortunately I guess this would require a kludge in the parser, but I think it would be more intuitive for the user.

      My personal preference, though, would be to require terminating semicolons on all statements. I suspect many natural languages use terminating punctuation like this (English certainly does), so I think it's an intuitive thing, and it's explicit, making things clear for the user (even if the compiler doesn't really need them).
    • Peter Gummer
      ... On the contrary, whitespace between the routine name and the bracket is the norm. The Eiffel coding convention is that there should be exactly one space
      Message 2 of 10 , Jan 2, 2010
      • 0 Attachment
        James wrote:

        > ... I think it's pretty rare to use any whitespace at all between a
        > function/procedure identifier and the following opening bracket, let
        > alone a newline.

        On the contrary, whitespace between the routine name and the bracket
        is the norm. The Eiffel coding convention is that there should be
        exactly one space between a routine name and the following opening
        bracket:

        print ("There's a space after the routine name.")

        This only goes to strengthen your main argument, however, because no
        one should be putting a newline where that space is supposed to be :-)

        - Peter Gummer
      • panfriedwoggle
        Yep, and that is almost the only Eiffel convention I hate.
        Message 3 of 10 , Jan 2, 2010
        • 0 Attachment
          Yep, and that is almost the only Eiffel convention I hate.

          --- In eiffel_software@yahoogroups.com, Peter Gummer <p-gummer@...> wrote:
          >
          > James wrote:
          >
          > > ... I think it's pretty rare to use any whitespace at all between a
          > > function/procedure identifier and the following opening bracket, let
          > > alone a newline.
          >
          > On the contrary, whitespace between the routine name and the bracket
          > is the norm. The Eiffel coding convention is that there should be
          > exactly one space between a routine name and the following opening
          > bracket:
          >
          > print ("There's a space after the routine name.")
          >
          > This only goes to strengthen your main argument, however, because no
          > one should be putting a newline where that space is supposed to be :-)
          >
          > - Peter Gummer
          >
        • berend@pobox.com
          ... panfriedwoggle Yep, and that is almost the only Eiffel convention panfriedwoggle I hate. Source code should be read like a book. Let me know if you find
          Message 4 of 10 , Jan 4, 2010
          • 0 Attachment
            >>>>> "panfriedwoggle" == panfriedwoggle <panfriedwoggle@...> writes:

            panfriedwoggle> Yep, and that is almost the only Eiffel convention
            panfriedwoggle> I hate.

            Source code should be read like a book. Let me know if you find a book
            where the parenthesis is appended to the preceding word...

            --
            Cheers,

            Berend de Boer
          • Martin Piskernig
            ... Parentheses can occur on many more different positions in a book s text than in a class text, so it is good that they are separated from the last character
            Message 5 of 10 , Jan 4, 2010
            • 0 Attachment
              Am Montag, 4. Januar 2010 19:52:48 schrieb berend@...:
              > >>>>> "panfriedwoggle" == panfriedwoggle <panfriedwoggle@...>
              > >>>>> writes:
              > panfriedwoggle> Yep, and that is almost the only Eiffel convention
              > panfriedwoggle> I hate.
              > Source code should be read like a book. Let me know if you find a book
              > where the parenthesis is appended to the preceding word...

              Parentheses can occur on many more different positions in a book's text than in
              a class text, so it is good that they are separated from the last character of
              a word (on contrary, in most language, notably except French, sentence
              terminators are written directly after the last character of the sentence).

              A programming language is for sure to be seen more like math (how many
              different punctuation symbols do you frequently use in a book? 5-6? how many in
              programming? 20?) than a book text and in math you typically don't put a space
              between a function name (or whatever) and its arguments. The vast majority of
              books doesn't do it and LaTeX doesn't do it, either.

              Taking your analogy further, it would be a nightmare to read a book's text in
              a language that doesn't force a sentence separator, or where every sentence
              should be written on a new line and only if two sentences occur on the same
              line, should they be terminated ;-)

              Regards,
              Martin
            • panfriedwoggle
              ... Parentheses in free text indicate a clause that can be removed from the text without affecting the grammatical structure or sense of the containing
              Message 6 of 10 , Jan 4, 2010
              • 0 Attachment
                --- In eiffel_software@yahoogroups.com, berend@... wrote:
                >
                > >>>>> "panfriedwoggle" == panfriedwoggle <panfriedwoggle@...> writes:
                >
                > panfriedwoggle> Yep, and that is almost the only Eiffel convention
                > panfriedwoggle> I hate.
                >
                > Source code should be read like a book. Let me know if you find a book
                > where the parenthesis is appended to the preceding word...
                >

                Parentheses in free text indicate a clause that can be removed from the text without affecting the grammatical structure or sense of the containing sentence. Arguments to a function are not like that at all. Your analogy does not hold.

                Arguments to a function in a programming language are like arguments to a function in maths. No space is used before the opening parenthesis in mathematical typography because the parentheses are effectively *part of* the function name, e.g. "sin(x)". The same should apply in Eiffel - it's not as if the parentheses and their contents are optional.
              • berend@pobox.com
                ... Martin Parentheses can occur on many more different positions in Martin a book s text than in a class text, so it is good that Martin they are separated
                Message 7 of 10 , Jan 5, 2010
                • 0 Attachment
                  >>>>> "Martin" == Martin Piskernig <martin.piskernig@...> writes:

                  Martin> Parentheses can occur on many more different positions in
                  Martin> a book's text than in a class text, so it is good that
                  Martin> they are separated from the last character of a word

                  Right, and that space is there for readability.


                  Martin> Taking your analogy further, it would be a nightmare to
                  Martin> read a book's text in a language that doesn't force a
                  Martin> sentence separator

                  Or spaces.

                  It's about readability people. That's why Eiffel uses '_' as word
                  separator in identifiers and is not camelcase etc.

                  --
                  Cheers,

                  Berend de Boer
                • berend@pobox.com
                  ... panfriedwoggle Parentheses in free text indicate a clause that can panfriedwoggle be removed from the text without affecting the panfriedwoggle
                  Message 8 of 10 , Jan 5, 2010
                  • 0 Attachment
                    >>>>> "panfriedwoggle" == panfriedwoggle <panfriedwoggle@...> writes:


                    panfriedwoggle> Parentheses in free text indicate a clause that can
                    panfriedwoggle> be removed from the text without affecting the
                    panfriedwoggle> grammatical structure or sense of the containing
                    panfriedwoggle> sentence. Arguments to a function are not like that
                    panfriedwoggle> at all. Your analogy does not hold.

                    I'm not talking about the *meaning* of parenthesis, but about the fact
                    that a space serves to increase readability. Try to read old manuscripts
                    that don't have them. Pretty hard, even if you're fluent in Greek.

                    --
                    Cheers,

                    Berend de Boer
                  Your message has been successfully submitted and would be delivered to recipients shortly.