#2366 fwt/demo.fan error

dxvictor Sat 18 Oct 2014

I just came across Fantom today. It looks awesome. I think if I can get fwt/demo.fan to work - it will all work. Mostly I'm just getting a lot of weird errors depending on whether I cut and paste or open a file from examples.

Right now I'm stuck on this error (line 1045 in demo.fan):

ERROR: demo.fan(1045:15): Expected expression, not '|'

pathTurtle := |->GraphicsPath|
{
  g.path
   .moveTo(40, 100)
   .curveTo(50, 30, 110, 30, 120, 100)
   .curveTo(170, 80, 170, 140, 120, 120)
   .lineTo(110, 120)
   .curveTo(115, 140, 95, 140, 100, 120)
   .lineTo(60, 120)
   .curveTo(65, 140, 45, 140, 50, 120)
   .lineTo(40, 120)
   .close
}

Is this a real error or is something else getting confused?

Also, at the beginning of the file there is this line: #! /usr/bin/env fan

I searched but could not find an explanation of its purpose. If its pointing to something it probably needs to be different on my setup.

I'm running Windows 10 64 bit, JRE 1.7 32 bit, SWT 4.4 on F4 IDE.

Thanks

SlimerDude Sat 18 Oct 2014

Hi dxvictor!

That error is explained (and solved) in An Introduction to the F4 IDE.

Essentially, F4 runs Fantom 1.0.63 and that demo.fan program requires Fantom 1.0.66. See Adding an Interpreter (for Fantom 1.0.66) in the same article for details.

Lemme know if the article helps or could be improved.

The #! /usr/bin/env fan notation is a unix shebang used to identify the file as a bash script. It is ignored by Fantom, and as a Windows user you can just delete it and forget about it.

Steve.

dxvictor Sat 18 Oct 2014

Steve,

Thanks. That fixed it. I'm very impressed with Fantom. I look forward to learning it and giving it a try.

Doug

Login or Signup to reply.