> > and am particularly confused by the fact that your argument 'bar' shadows 
> > the class field 'bar' and what that's supposed to mean
> 
> I had the impression that if a class has a generic field (bar in this case), 
> a constructor argument
> with the same name automatically assigns the type and value. At least that is 
> how it seems to work.

My mistake.  It took me awhile to realize that 'foo' was the name of the class, 
and even when I did, I
still had trouble thinking of 'foo' as a constructor name, but of course, 
you're correct.


Now that I'm back on track, the few things that occur to me are:

* I'm not sure that the planned support for the 'void' type would help you 
because, at present anyway, I don't think we envision there being any legal 
values of the void type, which would suggest you wouldn't have anything to put 
into the default argument position where the '0' is now.

* Given that files are a type that have an obvious built-in sentinel value 
(/dev/null, essentially), would it make sense to have the default value be that 
and to test against the value instead of against the type?  (this would also 
have the benefit of not requiring the class to be generic)

* Another way that it occurs to me to deal with this would be to store the 
'useBar' bit as a var or const rather than a param and to support two 
constructors, one taking zero arguments, one requiring one, and setting 
'useBar' based on which of the two was called.

-Brad


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to