Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

teach dotnet new how to create f# programs #4689

Closed
enricosada opened this issue Dec 24, 2015 · 18 comments
Closed

teach dotnet new how to create f# programs #4689

enricosada opened this issue Dec 24, 2015 · 18 comments
Assignees
Milestone

Comments

@enricosada
Copy link
Contributor

dotnet new should also scaffold f# program.

The template is not a problem.

What's the best way to specify the language?

  • command line argument ( --language F# ), default c# ?
  • new command dotnet-new-fsharp.exe ( like dotnet compile => dotnet-compile-fsc.exe )
  • new argument F# without --language

A personal feedback

make c# explicit like f# for new, asking what language use if not specified, is better long term, more dotnet, less c# dotnet.
Easier to discover for new user too

@davidfowl
Copy link
Member

make c# explicit like f# for new, asking what language use if not specified, is better long term, more dotnet, less c# dotnet.

I'm pretty sure it'll be hard to convince anyone that c# shouldn't be the default. It is today in all cases.

@enricosada
Copy link
Contributor Author

@davidfowl i know, but i need to ask, now dotnet is in beta/rc, after rtm is pretty much impossibile to change this behaviour

I really think it's not much different for csharp

  • --lang c# explicit

  • without args, ask a switch

       - 1 => C#
       - 2 => VB
       - 3 => F#
    

but it can be a really nice move to feel all dotnet languages like first class support in a shared dotnet cli.

It's ok to do --lang F#, really not a problem, it's more have the feeling of use a shared tool.
If an implementation is subpar the community can help, but API should be language agnostic

Atm it's really ok as dotnet not c# dotnet, i really like it compile, publish etc, good work!

Also defaults, when not really needed, are a problem in the future for backward compatibility changes

@davidfowl
Copy link
Member

There are default source globbing patterns that assume C# as well. It's not just new. When there's no language specified it assume csc is the compiler.

@enricosada
Copy link
Contributor Author

about compilerName, the default is csc, and that's ok for me, let me explain why.

I have not raised a question about that, because project.json is generated by tools usually, nobody care about that.

The tool the user run is dotnet new, the api for user, and that should be language agnostic.

If it's not possible it should be possible to change the default.
We can read from an DOTNET_CLI_LANG env var the default maybe, or an user .config file.
As an user it's easier for me to add this DOTNET_CLI_LANG once in the user env var, and forget about it.
if i need to write a c# program having f# default, i do dotnet new --lang=c#, not that bad.

There are default source globbing patterns that assume C# as well

I'll check these after dotnet-compile-fsc works, but for example that's a problem for vb, or other languages.
F# is going to use compileFiles, so i think each community should push to try to make the dotnet cli as language anostic as possibile, everyone has an agenda.
After all, after seven agenda points scored, you win the game ( sry, netrunner addict ).

I really like dotnet-compile-{compilerName} for example.

@davidfowl
Copy link
Member

project.json is not generated by tools, I'm. It sure what you mean. If you if you only care about new (which is pretty much a toy) then sure. It can be as complicated as it needs to be, I don't think it'll be used that much.

The point of having project.json be minimal and having defaults inferred is so that it is human friendly and can we author it without tools. I'd hate to see this turn into another csproj because it tries to cater to all scenario making it "work" for everything but ends up being verbose to achieve that.

@enricosada
Copy link
Contributor Author

@davidfowl i am ok with minimal project.json ( thx man about that ) and sane default. as i said, i am ok for default compilerName = "csc". I dont want an explicit compilerName on project.json.

i see dotnet new as the first OOTB experience of dotnet cli ( http://dotnet.github.io/getting-started/ ) and it's good like that. It's not about me and you, but new users.

Maybe yeoman and other scaffolding tools should call dotnet new, and add additional info to generated project.json, but that' another issue.

I dont think i ever written by hand a project.json, always copy pasted, but if i can do dotnet new i'll do that, because it's easier than copy paste for simple program.

I understand it's a toy, but that's the base experience, as i said, a nice to have as language agnostic.
If not possible, np.
the --lang=f# is required anyway if i need tools to call dotnet new so not a problem.

@enricosada
Copy link
Contributor Author

@davidfowl it's only a nice to have, really, i'd like to maintain language agnostic where possibile, the default like this one are a nice to have, but --lang is ok. The rest of dotnet suite is really ok

@shahid-pk
Copy link
Contributor

👍 for dotnet new defaults to c#
Reason 1 : I estimate almost 90% dotnet devs use c# for better or worse but that is the reality.
Reason 2 : A tool defaulting to something that has an estimated 90% or more use case doesn't make any other use case of the tool less first class citizen. It is only a convenience to majority of the users of the tool.

@TheRealPiotrP
Copy link
Contributor

@blackdwarf, we've been going back and forth on extending new like this. What's the latest?

@borgdylan
Copy link

Couldn't dotnet-new just issue a message on the console how to set the compiler that gets used plus a list of known compiler names that comes bundled with the CLI (csc/fsc/vbc?) ?

@enricosada
Copy link
Contributor Author

@borgdylan it's not only about compilerName, it's about also the files, Program.cs or Program.fs or Program.vb.
If i choose a language, i can add compilerName for f# ( and vb i think ) and correct source file..
i really think dotnet new is the first experience for some new developers ( for example dotnet new + notepad or vim ), so what's matter is the language ( c#/f#/vb/dylan/etc ).

Anyway sorry all, my bad, it's not a problem, ** i'll send a pr with --lang: F# ** or something like that.

Default or switch if no --lang, etc, is another issue, i dont want to start a flame war on default.

@shahid-pk
Copy link
Contributor

@enricosada 👍 for your work , really excited to use fsharp on linux (the ms version of fsharp).

@blackdwarf
Copy link

@piotrpMSFT we're pretty much where we were, with some ideas to allow for language overriding (i.e. what this issue is proposing). However, I do thing that dotnet new could be slightly more powerful without too much added complexity, so will be making a proposal on Mon.

@TheRealPiotrP
Copy link
Contributor

Thanks @blackdwarf. Looks like folks are excited to light this up, so let's make sure the story matches our plans!

@enricosada
Copy link
Contributor Author

i added f# with -f# and --fsharp arguments. default is c# ( -c# and --csharp )

@blackdwarf @piotrpMSFT i have done the implementation before reading your comments, if it's useless np 😄

@borgdylan
Copy link

The experience should allow plugins via more binaries being added just like dotnet-compile. The mechanism used by @enricosada requires the CLI to be modified.

@blackdwarf blackdwarf self-assigned this Jan 12, 2016
@TheRealPiotrP
Copy link
Contributor

@enricosada the PR here is still in need of rebasing. I'm moving out to RC milestone. Let us know if this can happen today.

blackdwarf referenced this issue in blackdwarf/cli Jan 16, 2016
Add a custom conclusion file that lists out the need for the user to install
OpenSSL 1.0.1/1.0.2.

Solves a bit #647
@enricosada
Copy link
Contributor Author

i added --lang with dotnet/cli#1027 , so f#/c# works.
Btw default it's c#, but command line it's pretty for all languages 😄 thx all for feedback.

Further improvement ( like dotnet new fsharp/console ) are discussed in dotnet/cli#655

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
@msftgits msftgits added this to the 1.0.0-rc2 milestone Jan 31, 2020
rainersigwald pushed a commit to rainersigwald/sdk that referenced this issue Jul 20, 2020
* Update dependencies from https://github.com/dotnet/arcade build 20200715.6

Microsoft.DotNet.Arcade.Sdk
 From Version 1.0.0-beta.20326.2 -> To Version 1.0.0-beta.20365.6

* Remove darc int feeds

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Jason Zhai <AzureTest@vwuzhai002.redmond.corp.microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants