David Hopwood wrote: > Torsten Anders wrote: >>On 14.03.2006, at 13:40, Andreas Franke wrote: >> >>>Sounds good to me. Because of the compiler warnings about unused >>>variables, I had adopted the following style for unused variables in >>>case patterns and procedure parameters: >>> _/*SomeThing*/ >>>In your proposal, I could just omit the comments and write _SomeThing >>>instead. >> >>I am in favour for anything which improves the Oz compiler warnings. >> >>Still, what is gained if you are allowed to replace _/*SomeThing*/ by >>_SomeThing, in case the latter is equivalent to _? > > - _SomeThing is shorter, and less ugly > - _SomeThing would be syntax highlighted like a variable, rather than like > a comment > - Haskell and Erlang programmers are familiar with this convention > > Even minor improvements in how "pretty" a convention looks can significantly > encourge its adoption. > > Note that the proposal is only that _SomeThing has different warning > behaviour, > not that it is equivalent to _. For patterns and parameters, this amounts to > the same thing because an unused variable is equivalent to _, and declarations > are implicit. However using _SomeThing in other contexts without declaration > would not be legal (just as it would not be for SomeThing). > > The only real disadvantage I can see is that _SomeThing is not currently > legal Oz (variable identifiers must start with an uppercase char), whereas > _/*SomeThing*/ is.
If the convention were for the name to *end* with _ (e.g. SomeThing_), then the syntax of variable names would not need to be modified, since _ is an alphanumeric character. While this is no longer the same as Erlang and Haskell, it requires no changes to the Oz language (other than the warning behaviour of the compiler), and so is probably a better approach for Oz. -- David Hopwood <[EMAIL PROTECTED]> _________________________________________________________________________________ mozart-users mailing list [email protected] http://www.mozart-oz.org/mailman/listinfo/mozart-users
