You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 17, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 17, 2022. It is now read-only.
struct A{};
struct B{};
fn to(A mut*self, B mut new*nu) {}
fn main() {
A a;
new b = a.to();
}
the reason it's currently broken is actually generated tail arguments make argument ordering a mess.
I want to get rid of auto-generated tail arguments anyway in favor of generic call-site assigns.
fn foh(int a, int b, char * other)
where a > 2
with b = 2 * a
{
}
I like with
fn foh(int a, int b, char * other)
where a > 2
where b = 2 * a
{
}
but I also like where...
fn foh(int a, int b = 2 * a, char * other)
where a > 2
{
}
This is very easy to understand
fn main() {
foh(2, "boh");
}
but I can see a reader having to come back to understand how it is used. Is there a keyword we could introduce in the argument signature the denotes the variable as a callsite argument?
fn foh(int a, int b = ifconstrained(typeof(vec::itema))) { vec::item(a) } else { u8 } , char * other)
where a > 2
{
}
actually skipping arguments in the middle is weird anyway. I'm going to require callsite arguments be at the end, which makes them very similar to default arguments in other languages, so we're also going with that familiar syntax
Activity
aep commentedon Sep 15, 2020
@jwerle
opinions on syntax for callsite assigns?
all of these are used by skipping the callsite arg:
and i feel like the last version makes that more obvious, although long expressions can look hard to read
jwerle commentedon Sep 15, 2020
I like
withbut I also like
where...This is very easy to understand
but I can see a reader having to come back to understand how it is used. Is there a keyword we could introduce in the argument signature the denotes the variable as a callsite argument?
oof! yeah that is hard to read ;)
aep commentedon Sep 15, 2020
yeah. probably we want that plus the full expression in the smt section, since its an smt expression, so...
or something. not sure about the keyword. this is too long
jwerle commentedon Sep 15, 2020
yeah something short and sweet
aep commentedon Sep 16, 2020
actually skipping arguments in the middle is weird anyway. I'm going to require callsite arguments be at the end, which makes them very similar to default arguments in other languages, so we're also going with that familiar syntax
jwerle commentedon Sep 16, 2020
yep that makes a lot more sense and we can avoid the extra keyword for the reader!