Order of evaluation for named arguments
monkyyy
crazymonkyyy at gmail.com
Tue Apr 1 12:04:36 UTC 2025
On Tuesday, 1 April 2025 at 11:26:34 UTC, claptrap wrote:
> On Tuesday, 1 April 2025 at 02:04:44 UTC, monkyyy wrote:
>> On Monday, 31 March 2025 at 23:16:57 UTC, claptrap wrote:
>>> On Monday, 31 March 2025 at 21:43:07 UTC, Salih Dincer wrote:
>>>> On Monday, 31 March 2025 at 19:47:01 UTC, Richard (Rikki)
>>>> Andrew Cattermole wrote:
>>>>> [...]
>>>>
>>>> +1
>>>>
>>>> If the probability is low, as Jonathan emphasizes, then
>>>> please change the behavior of the D compiler. Or if not, in
>>>> this case, here is the intermediate solution:
>>>>
>>>> **Add a warning or error message**
>>>>
>>>> "Named arguments are evaluated in parameter order, so be
>>>> mindful of side effects!"
>>>
>>> Or just require that parameters are always passed in the same
>>> order as the declaration. Makes this bug impossible, and no
>>> *silent* breakage.
>>
>> Doesnt that make the whole thing meaningless
>
> I thought the point was to document at call site, ie clarify
> long parameter lists, and enable skipping defaults?
>
> I mean I don't see the point of just being able to change the
> order the parameters are passed in?
Im still waiting on named argument templates disambiguation but
im worried about expressiveness
For example raylib has like 20 draw functions in a c verbose
style; it be nice to overload them all; but oh no draw line and
draw rectangle overlap (4 arguments, two x's and y's)
in thoery after named argument works with templates you can
redirect via parsing the .h defination easily
More information about the Digitalmars-d
mailing list