Using keywords as identifiers

52 messages Options
Embed this post
Permalink
1 2 3
Jonathan S. Ostroff

Console app Windows/Linux

Reply Threaded More More options
Print post
Permalink
We have an application set as a console app in windows

<setting name="console_application" value="true"/>

However, if the project is moved to linux we get a compile error

[ 80% -  2] Generating Auxiliary Files
[ 90% -  1] Generating Auxiliary Files
[ 100% -  0] Generating Auxiliary Files
*** glibc detected *** double free or corruption (!prev): 0x0d023a30 ***

Removing <setting name="console_application" value="true"/> allows the project to compile.

Is the console setting only allowed on Windows?

Thanks

Jonathan


Emmanuel Stapf

RE: Console app Windows/Linux

Reply Threaded More More options
Print post
Permalink
> We have an application set as a console app in windows
>
> <setting name="console_application" value="true"/>
>
> However, if the project is moved to linux we get a compile error
>
> [ 80% -  2] Generating Auxiliary Files
> [ 90% -  1] Generating Auxiliary Files
> [ 100% -  0] Generating Auxiliary Files
> *** glibc detected *** double free or corruption (!prev): 0x0d023a30 ***
>
> Removing <setting name="console_application" value="true"/> allows the
> project to compile.
>
> Is the console setting only allowed on Windows?

This option is allowed on all platforms but it has simply no effect on non-Windows platform. Which version of EiffelStudio were you using? Which version of Linux? Can you run the compiler under `gdb' to see where the double free operation is occurring?

Regards,
Manu

------------------------------------------------------------------------  
Eiffel Software
805-685-1006
http://www.eiffel.com       
Customer support: http://support.eiffel.com       
User group: http://groups.eiffel.com/join       
------------------------------------------------------------------------  
Jonathan S. Ostroff

RE: Console app Windows/Linux

Reply Threaded More More options
Print post
Permalink
ES6.3 GPL (final version) on CentOS4.6. Will have to try and obtain the project from the student to run gdb.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Emmanuel Stapf [ES]
Sent: Tuesday, May 19, 2009 2:12 PM
To: [hidden email]
Subject: RE: [eiffel_software] Console app Windows/Linux

> We have an application set as a console app in windows
>
> <setting name="console_application" value="true"/>
>
> However, if the project is moved to linux we get a compile error
>
> [ 80% -  2] Generating Auxiliary Files
> [ 90% -  1] Generating Auxiliary Files
> [ 100% -  0] Generating Auxiliary Files
> *** glibc detected *** double free or corruption (!prev): 0x0d023a30 ***
>
> Removing <setting name="console_application" value="true"/> allows the
> project to compile.
>
> Is the console setting only allowed on Windows?

This option is allowed on all platforms but it has simply no effect on non-Windows platform. Which version of EiffelStudio were you using? Which version of Linux? Can you run the compiler under `gdb' to see where the double free operation is occurring?

Regards,
Manu



------------------------------------

Yahoo! Groups Links




finnianr

Re: Using keywords as identifiers

Reply Threaded More More options
Print post
Permalink
In reply to this post by rfo
Hi all,
for years C++ programmers have been prefixing class member names with 'm_'. The Eiffel equivalent of this would be 'f_'.

The prefixes: 'c_', 'l_' and 'a_' are already in common use in Eiffel code, so my suggestion would be to adopt a convention of using 'f_' to avoid feature name clashes with keywords.

(Although I noticed that the 'c_' convention seems to be dying out for external routines)

Peter Gummer-2

Re: Re: Using keywords as identifiers

Reply Threaded More More options
Print post
Permalink
Finnian wrote:
> Hi all,
> for years C++ programmers have been prefixing class member names with 'm_'. The Eiffel equivalent of this would be 'f_'.
>
> The prefixes: 'c_', 'l_' and 'a_' are already in common use in Eiffel code, so my suggestion would be to adopt a convention of using 'f_' to avoid feature name clashes with keywords.
>  

Thanks, but no thanks. The 'l_' prefix that Eiffel Software has been
using recently (contrary to the principles espoused in OOSC2) is
damaging enough to the legibility of their code.

V_can p_you v_read p_this n_sentence c_with n_ease?

I don't want visual noise. I just want to call a spade a spade ... not a
'spade_' or 'l_spade' or 'f_spade'.

- Peter Gummer

rfo

RE: Re: Using keywords as identifiers

Reply Threaded More More options
Print post
Permalink
In reply to this post by Peter Gummer-2
Hi Peter!

Well said indeed.

     R

==================================================
Roger F. Osmond
----------------------------------------
Amalasoft Corporation
273 Harwood Avenue
Littleton, MA 01460

> -------- Original Message --------
> Subject: Re: [eiffel_software] Re: Using keywords as identifiers
> From: Peter Gummer <[hidden email]>
> Date: Fri, May 22, 2009 10:43 pm
> To: [hidden email]
> Finnian wrote:
> > Hi all,
> > for years C++ programmers have been prefixing class member names with 'm_'. The Eiffel equivalent of this would be 'f_'.
> >
> > The prefixes: 'c_', 'l_' and 'a_' are already in common use in Eiffel code, so my suggestion would be to adopt a convention of using 'f_' to avoid feature name clashes with keywords.
> >  
> Thanks, but no thanks. The 'l_' prefix that Eiffel Software has been
> using recently (contrary to the principles espoused in OOSC2) is
> damaging enough to the legibility of their code.
> V_can p_you v_read p_this n_sentence c_with n_ease?
> I don't want visual noise. I just want to call a spade a spade ... not a
> 'spade_' or 'l_spade' or 'f_spade'.
> - Peter Gummer

Emmanuel Stapf

RE: Forgeround Colour of Console/Regular expressions

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jonathan S. Ostroff
> In a .NET application one can get access to the foreground colours of
> text
> printed to the console via something like:
>
>   [DllImportAttribute("Kernel32.dll")]
>         private static extern bool SetConsoleTextAttribute
>         (
>             IntPtr hConsoleOutput, // handle to screen buffer
>             int wAttributes    // text and background colors
>         );
>
> so that we have output to STDOUT as green and likewise one can choose a
> different colour, say red, for STDERR.
>
> Is there a standard call for this in the base library (that would work in
> linux or windows). Class CONSOLE does not appear to support this.

Unfortunately there is no support for this at the moment, but we would welcome a
solution that is multiplatform.
 
> Also, in .NET one can parse using regular expressions directly (e.g.
> Regex("[ \t]+")). Is there a standard facility to this in the base
> library?

We provide the facility via the Gobo Regular Expression cluster, look at the
RX_PCRE classes.

Regards,
Manu

------------------------------------------------------------------------  
Eiffel Software
805-685-1006
http://www.eiffel.com       
Customer support: http://support.eiffel.com       
User group: http://groups.eiffel.com/join       
------------------------------------------------------------------------  
Jonathan S. Ostroff

How to use GOBO RX_PCRE for regular expressions?

Reply Threaded More More options
Print post
Permalink
<< Also, in .NET one can parse using regular expressions directly (e.g.
Regex("[ \t]+")). Is there a standard facility to this in the base
library?

We provide the facility via the Gobo Regular Expression cluster, look at the
RX_PCRE classes. Regards, Manu>>

Sounds useful. Are there some simple examples and documentation such as what
the pattern matching tokens are (is it the standard *, +, ? etc.) I was not
able to infer all this from the pcre.e example that was provided

Thanks

Jonathan

Paul Cohen

Re: How to use GOBO RX_PCRE for regular expressions?

Reply Threaded More More options
Print post
Permalink
Hi,

On Mon, Jun 8, 2009 at 11:27 PM, Jonathan S. Ostroff<[hidden email]> wrote:
> Sounds useful. Are there some simple examples and documentation such as what
> the pattern matching tokens are (is it the standard *, +, ? etc.) I was not
> able to infer all this from the pcre.e example that was provided

See:

    http://en.wikipedia.org/wiki/PCRE

and:

    http://www.pcre.org/pcre.txt

I don't know to what degree the Gobo regexp library is compliant with
that documentation.

/Paul

/Paul

--
Paul Cohen
www.seibostudios.se
mobile: +46 730 787 035
e-mail: [hidden email]
Eric Bezault

Re: How to use GOBO RX_PCRE for regular expressions?

Reply Threaded More More options
Print post
Permalink
Paul Cohen wrote:

> Hi,
>
> On Mon, Jun 8, 2009 at 11:27 PM, Jonathan S. Ostroff<[hidden email]> wrote:
>> Sounds useful. Are there some simple examples and documentation such as what
>> the pattern matching tokens are (is it the standard *, +, ? etc.) I was not
>> able to infer all this from the pcre.e example that was provided
>
> See:
>
>     http://en.wikipedia.org/wiki/PCRE
>
> and:
>
>     http://www.pcre.org/pcre.txt
>
> I don't know to what degree the Gobo regexp library is compliant with
> that documentation.

I don't know if it's 100% compliant, but it has been written
to be so, hence the name.

--
Eric Bezault
mailto:[hidden email]
http://www.gobosoft.com
helmut.brandl

Re: Re: Using keywords as identifiers

Reply Threaded More More options
Print post
Permalink
In reply to this post by Bertrand Meyer
I would like to come back to the issue since I have not yet heard a
satisfactory answer to Peter's request.

Eiffel is a language which allows elegant and readable code. This is an
advantage and a burden at the same time. People think a lot about class
names and feature names and want to chose the most appropriate ones.

If I wanted to write an Eiffel compiler, I have to represent classes and
features. What is a better name for a class which represents an Eiffel
class? Rhetoric question! Is is "CLASS". And the class name for a class
which represents a feature shall be "FEATURE", isn't it?

Since this is not (yet) possible, I would invent some private escape
mechanism. E.g. prefix all classes with a common prefix or whatever. In
other languages it wouldn't disturb me so much, since I have to make a
lot of compromises with readability anyhow. But in Eiffel it disturbs.
And for those who want to extract user documentation from the code base
it is disturbing very much!

And yes, it is not a question of life or death. But let me quote some
author which once stated "... style matters ...".

What is the benefit? The benefit is clear. Better readable code. What is
the price? I would say nearly nothing. E.g. let us take the escape
mechanism with single quotes

  class 'FEATURE'  .... end

  class 'ATTRIBUTE' inherit 'FEATURE' ... end

  class 'CLASS'  ... end

  class EIFFEL_SYSTEM feature
      features: ARRAY['FEATURE']
      system:   ARRAY['CLASS']
      ...
  end

Then it is a matter of the lexer to handle it. There are no one letter
keywords (and probably never will be), therefore no clash with manifest
characters. The readability is good, the single quotes are not disturbing.

Summary: The benefit is high in case of clashes, there is no
disadvantage and the cost to implement it for a reasonably written
compiler is low. Those who don't use it are not disturbed. Those who use
it are happier.

So the question of all questions: Why not?

Regards
Helmut




Bertrand Meyer wrote:

> I am skeptical of the benefit of all this. The rule that identifiers may not
> clash with keywords seems sound, especially given that there are not so many
> keywords.
>
>  
>
> Let's assume that we get into a frenzy of language extensions and introduce
> a keyword every two years over the next 50 years (after which few of the
> current users will presumably be interested). That's 25 keywords, of which
> presumably only a few, say half,  might be common words that have a
> significant chance of clashing with identifiers in existing code. Is it
> necessary to add a special language mechanism for a dozen cases?
>
>  
>
> The problem is of course common words such as `note' turned into keywords
> after many years in which they were free. A special compiler hack for such
> cases, whenever possible, seems preferable to a language mechanism. The
> problem with any language mechanism is that it requires changing user  code
> anyway. If you are going to change every occurrence of the identifier `note'
> to `@note' or some such convention, why not change it to a normal identifier
> name? This avoids polluting the code with strange notations, and encouraging
> nonstandard identifiers even in the absence of a conflict with existing code
> (i.e. what if people start calling their identifiers `@do' and `@feature' in
> new code?) At least a compiler hack lets you keep your code as it is, with
> the expectation that you will clean it up when you have time. Such a cleanup
> should happen just once.
>
>  
>
> So while I am willing to be convinced otherwise I don't think a special
> notation is justified.
>
>  
>
> Of course I sympathize with programmers who had the bad luck of choosing
> names that became keywords later on.
>
>  
>
> At the moment the only common word that could become a keyword is `across'.
> It's a good idea to stay away from it.
>
>  
>
> Thanks,
>
>  
>
> -- BM
>
>  
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
Paul Cohen

Re: How to use GOBO RX_PCRE for regular expressions?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Eric Bezault
Hi,

On Tue, Jun 9, 2009 at 12:46 AM, Eric Bezault<[hidden email]> wrote:
> I don't know if it's 100% compliant, but it has been written
> to be so, hence the name.

PCRE 5.0 has full support for Unicode/UTF8. Currently Gobo RX_PCRE
does not support Unicode/UTF8, at least not via Gobo UC_STRING as far
as I can see.

I guess one could work with UC_STRING.to_utf8: STRING_8. The special
characters *+,\$^[]()| should work without problems since they are
ASCII characters and have the same representation in UTF8. However the
character escapes \b, \B, \d, \D, \s, \S, \w, and  \W will not work.
Neither will setting case insensitivity which is quite a drawback.

Does anyone have any experience with this? Does anyone have any
recommendations for using RX_PCRE for matching UC_STRINGs?

/Paul

--
Paul Cohen
www.seibostudios.se
mobile: +46 730 787 035
e-mail: [hidden email]
1 2 3