Kevin Glynn wrote:
> Torsten Anders writes:
> > On 14.03.2006, at 17:02, Andreas Franke wrote:
> > > Torsten Anders wrote:
> > >> Still, what is gained if you are allowed to replace _/*SomeThing*/ by
> > >> _SomeThing, in case the latter is equivalent to _?
> > > Four characters. If you operate on an 80-chars-per-line style for
> > > source code, that's significant :-)
>
> > I would always hesitate before extending the core of Oz. Is it really
> > worth to extend the Oz syntax to save these four characters (in case _X
> > is equivalent to _) or even to introduce some slight semantical variant
> > (in case _X is a special form of X which does not trigger certain
> > warnings)?
>
> Nobody has argued for allowing _X to be equivalent to _.
>
> Since having _X as a special form of X which does not trigger certain
> warnings would require extending the language (to allow Variables to
> start with an underscore) then I think this would require someone to
> produce a Mozart enhancement Proposal (MEP).
>
> So far there doesn't seem sufficient support for this, but if there
> are people out there who like it, hate it, or would propose an
> alternative, please make your feelings known!
I propose the alternative of using variable names that end with _, rather
than start with _.
To borrow Borriss Mejias' example:
proc {Foo Id Name_ Address_} ... end
is more readable than either
proc {Foo Id _/*Name*/ _/*Address*/} ... end
or proc {Foo Id /*Name*/_ /*Address*/_} ... end
and pretty much the same in terms of readability as
proc {Foo Id _Name _Address} ... end
More explicitly, the proposal is:
- variable names that do not end in _ produce a warning by default if the
variable is unused
- variable names that end in _ produce a warning by default if the variable
is used
- the text of the warnings should suggest how to change the variable name
to reflect its [non-]use, so that this convention is discoverable by
new Oz programmers
- "synthetic" variables introduced by expansions do not produce any
used/unused warnings (this should also apply to the shadowing warning)
- the syntax and semantics of Oz do not change at all (and so Torsten
Anders' concern about breaking existing code does not apply).
Does there need to be a convention to mark synthetic variable names, like '$'
in Java (but conforming to the existing variable name syntax)? This might be
useful for code generation, as well as internally in the compiler.
--
David Hopwood <[EMAIL PROTECTED]>
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users