delete hash[key] deprecated???

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Feb 11 21:06:14 PST 2008


"Robert Fraser" <fraserofthenight at gmail.com> wrote in message 
news:for70f$2vf0$1 at digitalmars.com...

> I see another, much bigger, problem with "delete hash[x]" meaning 
> "hash.remove(x)" that goes against the D philosophy. One of the most 
> important things about D is that it is generally unambiguously parsed 
> without requiring semantic analysis. However, this is not so in the case 
> of a DeleteExp, which can either actually refer to a delete expression or 
> a function call. In other words, there are two semantic entities for 
> things that are syntactically identical (in that case "delete 
> [expression]"), and the effect of that depends not on the expression 
> itself, but, in fact, only a piece of the expression.
>
> Someone correct me if I'm misjudging this.

The "delete aa[x]" syntax to mean "remove the key x from aa" was deprecated 
in 0.126, that is, June of 2005, for the exact reasons you mention.  Hence 
the "deprecated" error message.  That the "deprecated" error message has not 
yet been removed after two and a half years seems to me more of an oversight 
than anything else. 




More information about the Digitalmars-d-learn mailing list