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 _?

I think _SomeThing should not be equivalent to '_'. The purpose of '_' is to create a variable without giving it a name, while the purpose of _SomeThing is to name a variable that will possibly not be used.

_SomeThing is not anonymous: it is treated like SomeThing, except that there will be no "unused variable" warning for it. So (1) generates a warning for Tail, while no warning happen for _Tail in (2) below:

   case L of Head|Tail then Head end    % (1)

   case L of Head|_Tail then Head end   % (2)

I noticed that it requires to redefine the syntax of variable identifiers. Currently _Tail is simply rejected by the compiler.

Cheers,
raph

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to