Skip to content

Support more liberal function application? #13

@kindaro

Description

@kindaro

For instance:

#include "share/atspre_define.hats"
#include "share/atspre_staload.hats"

val pi: double = 3.14159

fn circleArea (r: double): double = pi * (r * r)

fn ringArea (R: double, r: double) = circleArea R - circleArea r

val s = ringArea (5.0, 4.0)
val _ = print s

implement main0 () = ()

— Looks legit.

% patscc hello.dats && ./a.out
28.260000%
% atsfmt hello.dats
Error: 8:49
  Unexpected 'R', expected: 'Declaration'

— The compiler agrees, but atsfmt has an issue. Maybe add parentheses?

...
fn ringArea (R: double, r: double) = circleArea (R) - circleArea (r)
...

— But no:

% atsfmt hello.dats
Error: unexpected token '-' at 8:53

(What it actually dislikes is white space in function application.)

Either we should silently re-format function application or ignore the supposed issue, but surely not error out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions