Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

v0.7.1 #1155

v0.7.1 #1155
Jul 10, 2024 · 2 comments · 2 replies
Discussion options

What's Changed: Highlights

  • Add .. syntax to invoke only a member function (no UFCS), e.g., mystring..append("foo")
  • Allow x: const = init; and x: * = init; without _ type wildcard
  • Allow concatenated string literals, e.g., "Hello " "(name$)\n"
  • Faster compile time when doing heavy reflection and code generation
  • Ensure definite first use initialization cannot happen inside loops
  • Better diagnostics for illegal UFCS calls
  • Move-from-last-use only for moveable types
  • Remove whitespace sensitivity for * and &
  • Allow extra trailing commas in more places (assert)
  • Support latest GCC and Clang
  • Added -quiet
  • Added -cwd

New Contributors: Thanks again, and welcome!

Full Changelog: v0.7.0...v0.7.1


This discussion was created from the release v0.7.1.
You must be logged in to vote

Replies: 2 comments 2 replies

Comment options

Congrats for the release! Hope we get to see UFCS in C++ as well someday!

Does cppfront use the -> syntax for members of pointers (as in foo->bar(baz))? If not, I think it would be better if the language used -> instead of .. for member-only calls. Confusion is obviously a problem, but I believe it's trivial since the compiler can provide a diagnostic of the form:

Member function `bar` not found. Did you mean to call the UFCS function `bar`: `foo.bar(baz)`?
You must be logged in to vote
2 replies
Comment options

hsutter Jul 11, 2024
Maintainer Author

Thanks!

Cpp2 does not have -> because dereference is suffix, so *. is the equivalent. I currently have a special diagnostic check for -> to direct folks to *.... the message is error: '->' is not Cpp2 deference syntax - write '*.' instead. Currently -> is used exclusively for return types and I'd like to stick with that so that as much as possible one syntax has one meaning in the language. I chose .. because it's similar to . but I'm open to revisiting that if there's a usability reason to in the future... probably the biggest one would be ranges, if I wanted that syntax for something like 1..10 or first..last, but I think ... will work fine there as ... is already expressing a (variadic) series of things.

Comment options

Makes sense.

My reasons for using -> were purely because it feels more natural (to me foo-> reads exactly as "access something declared within foo") compared to .. (which like you mentioned, makes me think of ranges). Having a second thought about this, something like foo!.bar(args..) seems readable and also align with cppfront's idea of having postfix unary operators (always given that postfix !/!. is not used anywhere else).

Comment options

Hurray. 🎉🎉🎉

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /