Chapel: Slight Mistake in Docs for Point.writeThis

Created on 23 Feb 2020  路  12Comments  路  Source: chapel-lang/chapel

Most helpful comment

@CaptainLazarus Did you possibly define a module explicitly and include the code into it? Something like...

module Test {
// the code in the Primer here
}

(I stumbled on a similar problem before, so wondering if the reason for the error is the same.)

All 12 comments

@CaptainLazarus Did you possibly define a module explicitly and include the code into it? Something like...

module Test {
// the code in the Primer here
}

(I stumbled on a similar problem before, so wondering if the reason for the error is the same.)

@ty1027 - I suspect you are right. The above code is tested nightly and works because it is in a "prototype module".

@CaptainLazarus - See the error handling primer for more info on prototype vs. explicit modules with strict error handling.

After PR #14360, these writeThis methods should be marked throws

proc Point.writeThis(w) throws 
{
...
}

It would be appreciated if you can check if that resolves the issue for you and if so, make a PR against master making the change.

Tagging @dlongnecke-cray since this is an area he's worked in recently.

Sounds like there's some doc work to do.

After PR #14360, these writeThis methods should be marked throws

proc Point.writeThis(w) throws 
{
...
}

It would be appreciated if you can check if that resolves the issue for you and if so, make a PR against master making the change.

I checked but I ran into other issues. If we do mark the function as _throws_ then we need to _catch_ whenever we use writeln() for a Point record, which to me seems very tedious. Any thoughts? @mppf

@CaptainLazarus Did you possibly define a module explicitly and include the code into it? Something like...

module Test {
// the code in the Primer here
}

(I stumbled on a similar problem before, so wondering if the reason for the error is the same.)

This works
error3

I don't know how to check if its initialized or not (still searching).

There shouldn't be a way for you to get access to an uninitialized record unless you're within an initializer routine itself.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ben-albrecht picture ben-albrecht  路  3Comments

bradcray picture bradcray  路  4Comments

LouisJenkinsCS picture LouisJenkinsCS  路  3Comments

buddha314 picture buddha314  路  3Comments

BryantLam picture BryantLam  路  3Comments