4 ms·
I am curious about a few syntactic details: Why is the & (reference) argument convention a suffix? That seems inconsistent with Python’s *args and **kwargs, an
by fanf2 4y ago
I am curious about a few syntactic details:
Why is the & (reference) argument convention a suffix? That seems inconsistent with Python’s *args and **kwargs, and the keyword conventions.
What is the difference between the “owned” and “consuming” conventions?
And why is the ^ (consume) operator postfix? Python doesn’t have any postfix operators, and it seems awkward wrt the ^ infix xor operator.
- chrislattner 4y agoI'd love it if you could ask technical questions on the discord channel, as that's more scalable for us. Some quick answers: 1) We're likely to change the reference syntax to inout: https://github.com/modularml/mojo/issues/7 https://github.com/modularml/mojo/issues/7 2) they're the same thing. Consume is the word we're currently using for the operator, owned is the argument convention. We may need to iterate on terminology a bit more. 3) Because it composes properly with chained expressions: `x.foo().bar().baz^.do_thing()` vs something like `(move x.foo().bar().baz).do_thing()`
- derbOac 4y agoI worry a bit that postfix use of ^ is going to create some headaches with people expecting exponentiation.
- adgjlsfhk1 4y agocan you link the discord channel, I've seen it mentioned several times but haven't been able to find it. Edit: found it. https://discord.gg/modular https://discord.gg/modular