percyqaz / Percyqaz.Shell

Toolkit to add command line/IPC capabilities to your F# application
MIT License
1 stars 0 forks source link

Lambdas and first class functions #3

Closed percyqaz closed 2 years ago

percyqaz commented 2 years ago

First class functions is the concept where functions can be data/stored in variables and treated the exact same was as data

We have problems:

Commands are fundamentally different from variables Commands that take 0 arguments (arity 0) are still actions that can have side effects when run With first class functions, a variable should behave like a 0-arity function

By design function calls do not have brackets/tupling of arguments

Hence command is a command call with no arguments $command refers to a variable called command, no action taken the $ is needed to make the distinction

If a variable stores a lambda we cannot use the same syntax because $command is ambiguous - Do we want to execute it? or just refer to the action itself

percyqaz commented 2 years ago

I bet we can merge them now

If a variable x is a lambda then you can just write x to call it as a command All variables can be called via $x(args...) too Boom we have both

percyqaz commented 2 years ago

I merged them and stuff now