You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
selectFile = val chooser = new FileChooser
if chooser.showSaveDialog(null)==FileChooser.Result.Approve
then ^chooser.selectedFile
The call to showSaveDialog should be done in the gui thread, so an @GUI: annotation would be needed:
selectFile = val chooser = new FileChooser
@gui: if chooser.showSaveDialog(null)==FileChooser.Result.Approve
then ^chooser.selectedFile
However, other than with while, it seems to be hard to allow for this in front of if:, since an annotation is a termRaw, and an if construct is an Expr7. Maybe it can be done.
For the time being the programmer could enclose the if construct in braces.
Or maybe it would be convenient to write
if @gui: chooser.showSaveDialog(null)==FileChooser.Result.Approve
That syntax could be allowed without ambiguity problems. But maybe it would not be a good idea.
BTW it would be good if the implicit there parameter for the call to gui would inform the caller that it has some executable code, i.e. a code fragment, or a while, if, annotation, script call (and maybe more).
def executeCode[N <: CallGraphNode, R](n: N): R = {
This definition should than also become more specific than just N <: CallGraphNode.
Neither will work due to the nature of the predicate. It is a piece of pure Scala code on the VM value, not a script, hence cannot be annotated. Possible solution is to use do-then-else instead; the predicate of do is a script:
do selectFile(chooser) then foo else bar
selectFile =@gui: {!chooser.showSaveDialog(null)==FileChooser.Result.Approve!} ~~(result: Boolean)~~>if result then [+] else [-]
I disagree: syntactically it is possible, and semantically the annotation would as usual be executed when the if or while is activated, and it can do its work using the there pointer.
Thus while @a: c would do exactly the same as @A: while c,
and if @a: c then ... would be similar.
Indeed, seems possible.
On Feb 19, 2016 3:16 PM, "André van Delft" notifications@github.com wrote:
I disagree: syntactically it is possible, and semantically the annotation
would as usual be executed when the if or while is activated, and it can
do its work using the there pointer.
Thus while @A: c would do exactly the same as @Ahttps://github.com/a:
while c,
and if @A: c then ... would be similar.
—
Reply to this email directly or view it on GitHub #35 (comment)
.
Activity
AndreVanDelft commentedon Feb 19, 2016
whilemay be preceded by an annotation;ifcannot have that without cluttering up the syntax.I think now we need an uniform approach for both.
would work. Then also allow for
The latter would have the same meaning as having the annotation in front of
while.anatoliykmetyuk commentedon Feb 19, 2016
Neither will work due to the nature of the predicate. It is a piece of pure Scala code on the VM value, not a script, hence cannot be annotated. Possible solution is to use
do-then-elseinstead; the predicate ofdois a script:AndreVanDelft commentedon Feb 19, 2016
I disagree: syntactically it is possible, and semantically the annotation would as usual be executed when the
iforwhileis activated, and it can do its work using thetherepointer.Thus
while @a: cwould do exactly the same as @A: while c,and
if @a: c then ...would be similar.anatoliykmetyuk commentedon Feb 19, 2016
Indeed, seems possible.
On Feb 19, 2016 3:16 PM, "André van Delft" notifications@github.com wrote: