Only want to say
Jacob Carlborg
doob at me.com
Wed Jan 6 17:56:59 UTC 2021
On 2021-01-05 14:05, Andre Pany wrote:
> Yes, tuples are a core strength of D, but the syntax is not great. My
> hope is with the tuple dip we will be able to have a python like syntax:
>
> (Python numpy example)
> arr = numpy.array([('a', 0), ('b', 1)])
>
> My gut feeling is, we will be able to compete with numpy if we can
> provide tuple syntax as python can provide.
I would love to have a better syntax for tuples in D but I'm very
skeptical that D would be anymore or less suitable to do the same things
as numpy does only based on getting a better tuple syntax.
The above example could be implemented as a variadic template in D:
auto arr = array('a', 0, 'b', 1); // less syntax then the Python example
Template constraints can be used to make sure there are even number of
arguments and of the correct types.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list