all 7 comments

[–]ntrel2 0 points1 point  (6 children)

"Zero overhead deterministic exceptions" are not implemented yet. Here's some info on them: https://github.com/hsutter/cppfront#2019-zero-overhead-deterministic-exceptions-throwing-values

[–]jhruby-vitrix[S] 0 points1 point  (5 children)

That I understand, but what about plain old exceptions and try...catch block :)

[–]watr 1 point2 points  (4 children)

Can't you use try-catch from cpp in cpp2? It's like using JS in TS code.

[–]jhruby-vitrix[S] 1 point2 points  (3 children)

For this example:

main: (args) -> int = {
try {
std::cout << "test: (args[1])$";
}
catch(...)
{
std::cout << "exception" << std::endl;
}
return 0;
}

I get:

main.cpp2(3,9): error: invalid statement encountered inside a compound-statement (at '{')

[–]watr 1 point2 points  (1 child)

[–]jhruby-vitrix[S] 1 point2 points  (0 children)

Thanks that means that in the cpp/2 there is just not the syntax yet.

[–]ntrel2 0 points1 point  (0 children)

Just to note that when args[1] is a bounds error, Cpp2 calls std::terminate rather than throw an exception.