lf-lang / lingo

Package manager and build tool for the Lingua Franca coordination language
BSD 2-Clause "Simplified" License
4 stars 1 forks source link

Implement Project setup for different Targets #5

Open tanneberger opened 1 year ago

tanneberger commented 1 year ago

Desired behavior

    $ lingo init cpp
    $ lingo init zephyre

Creates Lingo.toml and ./src/main.lf with the correct target set and potentially other needed files.

Help

=> The explanation refers to #6

lhstrh commented 1 year ago

Note that zephyr is a platform, not a target, so I think the syntax more likely should be something like lingo init c zephyr.

erlingrj commented 1 year ago

Will have a look at this during the weekend!

erlingrj commented 1 year ago

An option is to fork this example repo and add some commands to west and a HelloWorld.lf. Then lingo init c --platform=zephyr (or however we want it), will clone the forked repo. A disadvantage is that we are dependent on an external repo

cmnrd commented 1 year ago

For the syntax I like --pltatform= a lot better. Its always easier to understand named arguments. I would even use a required --target= argument instead of the positional argument used above.

lhstrh commented 1 year ago

I agree that the more rigid way of dealing with parameter might be more readable, but it's annoying to type and harder to remember than a quick shorthand. I think we should take a careful look at how recent package managers work and how they deal with arguments.

lhstrh commented 1 year ago

There is something to be said for having a more imperative and readable style of giving commands. I personally like lingo init zephyr a lot more than lingo init --platform=zephyr.

cmnrd commented 1 year ago

The thing with positional arguments is that they are hard to remember. If we mix in the target, e.g. lingo init C zephyr, it becomes hard to read and understand. In this example it is clear what is the language and what the platform, but there surely are possible pairs where it is not so obvious. And also when typing, you always have to remember both the order and the meaning of the positional arguments, while with --target and --platform you only need to know that you want to give a target and a platform, but do not need to worry about the order.

lhstrh commented 1 year ago

I get your point./ Still, I think we should resist the temptation to achieve too much generality with what one can specify on the command line. After all, we have a configuration file, which is much easier to edit than configure using an elaborate command that inevitably will start to look like the o figuration file itself.