auto main() -> int
{
// the compiler doesn't know what "person_t" is
return person_t("crim", 1234).age;
}
// because it's declared below the caller
// and this is necessary in c/c++ because
// syntaxes such as
// `a * b` as statements are ambiguous,
// and can be parsed correctly only doing sema during parsing.
// coupling sema and parsing makes it necessary to have a forward declaration
// of "person_t" (actually not possible in this case,
// but it is with functions, which are currently affected by the same problem)
// so that we now know what "a" is, in order to know
// what the statement is as well
struct person_t
{
char const* name;
int age;
person_t(char const* name, int age) { helper(name, age); }
// in containers such as classes, you can actually
// use code declared below
auto helper(char const* name, int age) -> void
{
this->name = name;
this->age = age;
}
};
but this ambiguities are no longer a thing when using #feature on new_decl_syntax.
here is my question, would it be possible for circle compiler to avoid the need to forward declare members when "new_decl_syntax" is enabled? since it kills ambiguities
(or is this already possible to achieve? because i couldn't find anything related in the circle doc)
a problem that c/c++ ambiguous syntax made is
but this ambiguities are no longer a thing when using
#feature on new_decl_syntax
.here is my question, would it be possible for circle compiler to avoid the need to forward declare members when "new_decl_syntax" is enabled? since it kills ambiguities
(or is this already possible to achieve? because i couldn't find anything related in the circle doc)