Python-like Use of the Comma Expression

Timon Gehr timon.gehr at gmx.ch
Thu Aug 10 11:25:15 UTC 2023


On 8/10/23 12:41, Basile B. wrote:
> On Thursday, 10 August 2023 at 02:28:08 UTC, Timon Gehr wrote:
>> On 8/8/23 18:47, Vijay Nayar wrote:
>>>
>>> **Question**: Would D benefit from using commas to define tuples 
>>> rather than triggering an error when the result of a comma-expression 
>>> is used? Right now, because the errors, the result of a comma 
>>> expression is a bit of "unused real estate" in the language.
>>>
>>> The easy syntax for dealing with tuples of values is especially 
>>> useful in writing logic for machine-learning algorithms, and has 
>>> helped Python gain and hold a strong foothold in this area, but where 
>>> performance is needed, Python libraries like PyTorch turn to C++. 
>>> Perhaps this could be D instead.
>>
>> The answer is yes, though I don't think changing the precedence fits 
>> the D grammar.
>>
>> My DIP draft: 
>> https://github.com/tgehr/DIPs/blob/master/DIPs/DIP1xxx-tg.md
>>
> 
> That link is for static-foreach, right one is 
> https://github.com/tgehr/DIPs/blob/tuple-syntax/DIPs/DIP1xxx-tg.md

Oops! Not sure how I accidentally switched back branches (it was 4:28 am 
though). Thanks for the correction!


More information about the Digitalmars-d mailing list