HackerTrans
TopNewTrendsCommentsPastAskShowJobs

janjones

no profile record

Submissions

Zed for Windows: What's Taking So Long?

zed.dev
88 points·by janjones·11 mesi fa·80 comments

Proxy 4: The Next Leap in C++ Polymorphism

devblogs.microsoft.com
8 points·by janjones·11 mesi fa·0 comments

The Bitcoin scandal shaking Czech politics

expats.cz
1 points·by janjones·anno scorso·0 comments

comments

janjones
·6 mesi fa·discuss
Clarified my comment a bit, thanks
janjones
·6 mesi fa·discuss
Then you are already using XMake (albeit a different one than OP), it's the original codename for MSBuild, still present in the code: https://github.com/dotnet/msbuild/blob/main/src/MSBuild/XMak... :)
janjones
·7 mesi fa·discuss
Yes, it's contextual. There is more details in this section of the article: Naming Conflicts with Existing Class Members
janjones
·anno scorso·discuss
C# playground (compiler explorer) which runs entirely in a browser (via WebAssembly). Started as an alternative to SharpLab which is not maintained anymore. But it can also do some other stuff that I wanted like downloading any compiler version, and compiling Razor. Recently I've added some "IntelliSense" features to improve the editing experience.

https://lab.razor.fyi/

GitHub: https://github.com/jjonescz/DotNetLab
janjones
·anno scorso·discuss
> From a user perspective, "dotnet run" does add a new scripting dialect.

By dialect I mean that in CSX, the C# language has subtle differences in behavior compared to CS files (e.g., top-level methods are compiled differently). In 'dotnet run app.cs', the C# is exactly the same, hence it can be converted to a project (and we have a command for that - 'dotnet project convert').

> It's just a preprocessor - not a change to the C# syntax.

Should #:load work in normal C# files as well then? If yes, we would have two ways to include files - the normal way (include them in the project) or via #:load. If not, how would 'dotnet project convert' work? (It could paste the text but that's not very DRY if it's imported at multiple places.)

That's in short why #:load doesn't play very nicely with existing C# (it's a different paradigm of including other files). So the current proposal is to just make files in the same folder visible (just like they would be for a .csproj), because that's consistent with current C#, 'dotnet project convert' works, etc. But this proposal is not final yet, there are other options including what you suggest - see https://github.com/dotnet/sdk/issues/49193.
janjones
·anno scorso·discuss
> You can't do much of anything in .NET without referencing Nuget assemblies.

And referencing NuGet assemblies is of course supported via the #:package directive. It's just that referencing DLLs directly is not a common scenario, hence it's not supported for now (but can be added later).

> Agreeing with others, '#r "nuget:' should at least be an option.

Thanks, we hear you and plan to add support for it, see https://github.com/dotnet/sdk/issues/49199

> And otherwise (but I guess regarless if you stick with this syntax) you will have to add another tab to Nuget called "dotnet run". "Script & Interactive" is already present in Nuget and shows the #r syntax for a reference.

Agree but also note that the ".NET CLI" tab which tells you to run "dotnet add package" should also work in near future, see https://github.com/dotnet/sdk/issues/49200.
janjones
·anno scorso·discuss
> Is #:package <pkg> really so much nicer than #r "nuget: <pkg>" as to deserve deviating from .NET Interactive, F# and the existing NuGet picker? (It could be, if properly argued!)

Yes, we believe so. There is not much to be gained from reusing the syntax (it's not like you can import cs from csx or vice versa). We are also adding other directives, e.g., `#:property` - it would not make sense to reuse `#r` for that. `#r` is short for "reference", because it was originally meant for referencing DLLs which is discouraged in modern .NET. The main motivation for file-based programs is to lower the entry barrier, and having opaquely named directives like `#r` seems counter-productive.

> On that note, is any language other than C# supported for `dotnet run`?

File-based programs are for C# only. F# already has `dotnet fsi`. VB support seems unlikely per the language strategy: https://learn.microsoft.com/en-us/dotnet/fundamentals/langua...

> Is the machinery at least documented for other MSBuild SDKs to use?

There is really not much special machinery, an in-memory csproj file is created and built via MSBuild just like an on-disk csproj would. Any MSBuild SDK can be used via the `#:sdk` directive.
janjones
·anno scorso·discuss
F# and C# are intentionally different languages, I don't think it makes sense to have 100% equivalent functionality in both. AFAIK, F# already has scripting functionality built in. VB support could be added, but that seems unlikely given https://learn.microsoft.com/en-us/dotnet/fundamentals/langua...
janjones
·anno scorso·discuss
Referencing other projects is currently out of scope (and might always be, file based programs are intended to be simple), you can convert file based programs to full projects though to regain full functionality.
janjones
·anno scorso·discuss
.NET interactive uses a dialect of C# - the script dialect. With file based apps, we strive to use the standard C#, so you can convert file based apps to full projects at any time.
janjones
·anno scorso·discuss
Assembly references are not really a mainline scenario, hence we support nuget package references only for now. And `#r` is just too opaque (it comes from old times when assembly references were the norm).
janjones
·anno scorso·discuss
What do you mean by incompatible? If you mean syntax, that's different intentionally for clarity and also we don't want to create a new C# scripting dialect hence it isn't possible to "import" other files (that's not how C# works).
janjones
·2 anni fa·discuss
For anyone wondering, this is just the IP address written in a different form: https://stackoverflow.com/a/56814434