Комментарии:
I like acast better than special chars, it's unlikely to show up as part of var name or something of that ilk. Maybe if you misspell spellcast.
ОтветитьI thought maybe renaming cast to forge, and call autocast cast. Renaming cast seems silly, but forge seems like a stronger concept than casting so that was my logic
ОтветитьWhich theme are you using,i mean this c++ theme, pls tell me
ОтветитьFirst time commenting, been religiously watching your videos, and is very enjoyable :D
I have a question though. Why use 'xx' as the autocast? All of the other syntax makes sense, and very easy to understand. xx means nothing to me, even if I knew it was autocast. I prefer acast in my opinion.
Here is food for thought. 'cast(type) value' is obvious, and I know what it means. Just like 'acast value'. But now it's some two letters... maybe its 'ac value'? Nope... Maybe it was 'aa value'? Nope... Maybe I was wrong, lets check docs. (1minute later) Damnit Jonathan >:|
If you really want it small like that. Instead of 'xx', use 'ac' for autocast maybe?
Random thought: The thing that has always bugged me about pointer math in C++ is that it's very easy to forget / misread the code as dec/incrementing by single bytes instead of entire bytes / words / struct sizes. How about making this explicit by introducing a symbol to denote that it's not incrementing by single bytes? e.g. newAddress += 2 * that (where "that" is a symbolic representation of the size of increment).
Ответитьi really like the "as" from C#
Ответить,, is really nice in my opinion
ОтветитьMaybe "coerce"
ОтветитьI think the postfix notation wouldn't be so bad. This:
x = y cast(Type);
would naturally be pronounced as "x gets the value of y casted to Type". If you put the cast on the left side you couldn't pronounce it in the same order.
Also all definitions have the name on the left side and the type on the right. It would only be natural for casts to have the type on the right side as well.
Last argument: If I write a statement, I usually write the statement first and insert the necessary casts last. So I usually have to go back to the middle of the statement and insert the cast. With the cast on the right side this process would be much easier.
I think something like acast is already quick enough to type. Anyone needing any more speed than that to type a cast is either casting to much or needs to improve his typing speed.
Also, I just realised by changing the cast syntax to prefix operator you made it regular, so it's really an improvement. Specially if searching and replacing for casts / auto casts ends up being an important thing in the language.
I'm still not sure why cast(var, type) isn't a good option?
What if you did something like C++ cast<type>(var) or cast(type)varOr how about: var as type
Jonathan Blow cast(type) val or cast(val) both seem fine to me. XX seems quite meaningless though... suggestions:
return ?? result;
return var result;
Trouble with ?? is that it could be in comments, so that could be a minor irritation when you're trying to find-and-replace casts.
As for bitwise operators, while I understand you consider those to be high-value, I am not sure if it's something that you should change. In other words, until there's an actual use-case where you might want to use & | etc, I would just leave them untouched. Just my opinion, but those operators are so consistent over a whole range of programming languages that it seems odd to go against the norm.
If it were me I would like casting like
<u32>result
and auto
<> result or <?> result
how does the byte code work ?
Is he generating assembly?
or Is he using some library?
FYI:
Moving breakpoints in later VS can still be achieved by right clicking on the breakpoint (either in the source or breakpoint windows), going to 'localtion', and changing the line number.
It's not as nice and dragging it around, but at least it saves you from retyping the conditions.
In my opinion "acast" is easily the clearest in intent while also fast to type.
ОтветитьI personally would have gone with @ ... it's like an 'a' and a 'c' all rolled in to one, conveniently a shorthand for the initials of autocast.
ОтветитьI would consider replacing "cast" with "as" - it is easier to type (a and s lies next to each other). Then auto inferred cast would be something like "as?" where question mark would highlight that type is "guessed".
ОтветитьI really like the double underscore. Double comma would clash with the way I write stuff when using functions. I usually put the commas and step between them inserting whatever I wanted to pass. If I missed two arguments that'd be a cast into an overloaded function.
But I acknowledge that what I do is weird and stupid.
Most likely
return acast result; <- most unequivocal
return as result; <- most C#
return ?! result; <- most hilarious
(I actually kinda like "?!"; ? implies inferred or queried, ! implies cast or decree. Not great for comment search-replace, I'll admit.)
I'm figuratively screaming at my screen here :P
It's an auto-cast. Call it "autocast".
I personally would've (and am currently planning to) use `auto` as my autocast keyword. I could also use `cast` since my casting is done as `expr as type`.
Ответитьthis comment is outdated by now, but I enjoy acast for explicitness
void cast like "cast()" appeals to me too cause it's still explicit and searchable
xx ,, __ >< doesn't strike me as explicitly a "casting" thing, but i guess that's because they don't exist yet
I like the "cast" "forge" semantics suggested by other comments
What is "poison" in types list? Some kind of debugging thing?
Ответить