Hi Nicholas,

Thanks for the detailed and informative reply.

The writeln line was not part of the language spec.

Thank you once again..


On 5 May 2017 6:06 pm, "Nicholas Park" <[email protected]> wrote:

Hi Tomsy,

I think this is because you're directly printing the sync variable. This
results in questions like "Should writeln() block until count$ is full?"
and "If count$ is full, should writeln() leave it empty?". Since these
decisions may be specific to the use-case, the compiler forces you to use one
of the explicit read??() methods
<http://chapel.cray.com/docs/master/builtins/internal/ChapelSyncvar.html#ChapelSyncvar.sync.readFE>
.

The compiler error suggests that you make a change such as:

> writeln("Count = ", count$.readFF());

in order to print out the value in count$. You'll have to choose whether
readFE() or readFF() suit your use-case.

If this code is directly from the language spec, then the spec probably
needs to be updated.

Nick

On Fri, May 5, 2017 at 2:09 AM, Tomsy Paul <[email protected]> wrote:

> Hi all,
>
> I was trying to compile a program from Language spec.
>
> var count$:sync int = 0;
> cobegin {
> count$ += 1;
> count$ += 1;
> count$ += 1;
> }
> writeln("Count = ",count$);
>
> On compilation, it resulted in an error:
>
> $CHPL_HOME/modules/standard/IO.chpl:3743: error: sync variables cannot
> currently be written - apply readFE/readFF() to those variables first
>
> What is wrong?
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Chapel-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/chapel-developers
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to