Overloading opCast with multiple types

Kristian kjkilpi at gmail.com
Tue Oct 3 13:25:58 PDT 2006


On Tue, 03 Oct 2006 21:39:15 +0300, Stewart Gordon <smjg_1998 at yahoo.com>  
wrote:
> Kristian wrote:
> <snip>
[snip]
>
> Please see my proposal
>
> http://tinyurl.com/p2pn4
>
> It's very similar to your idea, but makes use of "cast", which is  
> already a keyword, to be treated differently from ordinary function  
> names.
>
> Stewart.
>

If there will be multiple cast functions some day, I think the syntax "T  
cast() {...}" would be very nice. As you said, it makes a distinction from  
ordinary functions (and operator functions) by its name, which is a  
reserved word.

(Of course, assuming that D will never have an ability to overload  
functions by their return values... ;) )



More information about the Digitalmars-d mailing list