DIP Draft Review News

rikki cattermole rikki at cattermole.co.nz
Mon Jun 4 11:28:26 UTC 2018


On 04/06/2018 10:39 PM, Yuxuan Shui wrote:
> I've dwelt on this for a couple of months now, and keeping thinking on 
> it myself is not going to help. That's why I'm asking for feedback.

Hum

Changes possible usage syntax, given that the only attribute that does 
this currently is @property which people want to remove (as it mostly 
does nothing), a pragma might be a better option.

```D
pragma(namedParameters, true):
```

By making it a pragma, it also makes it an override for a future 
possible extension (e.g. my DIP with better syntax). So that it becomes 
a compiler extension not a language feature.

If no future DIP to extend it happens, a dedicated attribute can be 
added instead (like you have).



Changes summarized:

1. Overload resolution does not change
2. Arguments (named names gets erased as far as overload resolution is 
concerned)
3. When multiple definitions of a function prototype are found with 
types of parameters matching and is not templated then the names will go 
into a single definition in the AST for a given scope. These alternative 
names can be used for verification with named arguments, but all 
arguments names must match a single set of parameter names and cannot be 
mixed.
	Thought: Couldn't we have alternative names in the parameter instead? E.g.
```D
void foo(int x/x0/width, int y/y0/height){}
```
	This simplifies having to keep whole prototypes around (which can be a 
real pain especially with templates that it would otherwise not work for).
4. New calling syntax ``Identifier : ConditionalExpression``
	FIXME: fix your DIP to that FYI, ``foo(width:x=7)`` probably isn't what 
you want to have supported.

I'll copy this into the PR comments if I haven't misunderstood something 
big.


More information about the Digitalmars-d-announce mailing list