I'm all for using `in` in the `for` syntax, and then using the `in`
keyword as part of the allocation interface sounds like a good idea.
But isn't that interface as presentatd a bit limited? At least, if it
uses *mut u8 and is unsafe then `foo() in bar()` would be the same as
`*bar() = foo()`, right?
Don't we need something like `alloc <expr>` for evaluating an expression
into a new allocation,
and `alloc <expr> in <expr2>` for evaluating an expression into an new
allocation inside of `<expr2>`?
[...]
So I'm wondering how this looks for people:
<expr> in <expr>
as a new bottom-precedence binop. The RHS is evaluated first, to a
*mut u8 or perhaps some lang-item trait we define for "the interface
to a memory allocator", then the LHS is "evaluated into it". I do not
_think_ it would collide with "for <pat> in <expr>", unless my eyes
confuse me. It might need to be an unsafe expr; not clear.
Any thoughts? Ghastly? Convenient? I don't much like evaluating RHS
before LHS but in this case it seems like it'd be necessary. And lest
you complain that reusing 'in' this way is a comprehension menace, I'd
point out that we reuse several other keywords in differing contexts
('for', 'mod', 'self', 'super') without too much confusion.
-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev