Open MeAmAnUsername opened 4 years ago
Problem: tasks and functions are different, because a task takes an implicit ExecContext
and the rest of the parameters in an nested Input
class. Might be solvable by explicitly disambiguating between the two with func
and function
(todo: create better name. func
and task
is good except that func
in a declaration means task
).
Allow creating lambdas, passing lambdas, referring to functions by name and applying functions.
Use cases
Some of the options in #15
Call multiple functions on a file and then handle all results the same afterward
becomes
Reparsing can be made generic over which specific parse and prettyprint are used
Could create a spoofax 3 project data with references to specific parse, style, prettyprint etc. functions (depends on #33). This would make the reparse test function above just take such a
spoofaxProject
data.Allows threading values in list comprehensions, i.e.
reduceLeft
. See #61.Syntax
Lambdas
Extra: allow as parameter name multiple times, means that parameter is ignored. Bonus extra: does not require type? Could use
TopTy
in that case?Function Types
Type.FuncTyHeader = FuncHeader
, e.g.val parse: func(ast: IStrategoTerm) -> IStrategoTerm = example:cpp:parse;
Option: allow leaving out thefunc
and parameter name, e.g.val plus: (int, int) -> int
Requires thatFuncHeader
becomes right associative so that a function can return a function:Application
Exp.Application = <<Exp>(<{<Exp> ", "}*>)> // or Exp.Apply; e.g. plus(a, b)
This is ambiguous withCall
(foo()
could be application of variablefoo
or call to functionfoo
. Remove function calls, application can be used on bothFunc
andVar
? See https://slde.slack.com/archives/C7254SF60/p1594220454206400Should be left associative, see curriedPlus above