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

Re: [eiffel_software] Re: Scope prefixes for variables (was: dead slow String manipulation)

Expand Messages
  • Eric Bezault
    ... I wish people would also write assertions 80% of the time. But they don t ;-( Personally if I have the choice I would prefer that people use more time on
    Message 1 of 50 , Apr 1, 2006
      Peter Gummer wrote:
      > 2. It's reliable. We humans will never use prefix conventions 100%
      > correctly -- we'd be lucky to get it right 80% of the time

      I wish people would also write assertions 80% of the time.
      But they don't ;-( Personally if I have the choice I would
      prefer that people use more time on writing assertions
      than on finding better names than a_ or l_. For example,
      let say that a routine `f' needs a title and a text as
      argument. I prefer to read:

      f (a_title, a_text: STRING)

      equipped with well written assertions, rather than things
      like that (which I already saw in some GUI libraries);

      f (ttl, txt: STRING)
      f (t1, t2: STRING)
      f (s1, s2: STRING)

      As a human, I read it as "f takes as arguments 'a title'
      and 'a text'". It reads better than the other 3 versions
      above. But it's probably a question of personal taste.

      Of course here I'm not talking about the fact that
      a_ and l_ are used as name scope prefixes. In fact when
      I started to use 'a_title' and 'a_text' in my code,
      it was not meant to be the prefix 'a_' for arguments
      (and 'l_' for locals), but really "a title" and
      "a text". I was even using 'a_title' as local variable
      name because that's the way I read code. It's just
      "a title". The convention about 'l_' appeared only
      after, and even though my code does not read so nicely
      with 'l_title' instead of 'a_title' and that I agree
      that syntax highlighting would be definitely better
      to address the issue it is supposed to solve, I
      progressively adopted the 'a_' and 'l_' convention
      in my code because that's what is used more and more
      often and I want Eiffel code not to look too much
      different when reading classes from one library or
      another. At work we have an Eiffel code base made up
      of more than 14,000 classes and it really makes a
      difference.

      --
      Eric Bezault
      mailto:ericb@...
      http://www.gobosoft.com
    • Peter Gummer
      ... I seem to recall that ECMA Eiffel allows Unicode identifiers. EiffelStudio doesn t seem to have got around to this yet; if I include é in an identifier
      Message 50 of 50 , Apr 2, 2006
        Thomas Beale wrote:
        >(and just think: "new_xxx" in
        >french would be "nouveau/nouvelle/nouveaux _xxx".... although, works
        >nicely if you are passing arguments like "riche" and "cuisine";-)

        I seem to recall that ECMA Eiffel allows Unicode
        identifiers. EiffelStudio doesn't seem to have
        got around to this yet; if I include é in an
        identifier then the compiler reports the universal error message:

        Syntax error at line 21 in class BAR

        set_title (écran: EV_SCREEN) is
        ---------------^

        Ou là là!

        - Peter Gummer
      Your message has been successfully submitted and would be delivered to recipients shortly.