Readit News logoReadit News
jaredpar commented on Run a C# file directly using dotnet run app.cs   devblogs.microsoft.com/do... · Posted by u/soheilpro
bouke · 7 months ago
Not GP, but can confirm on my M3 Max using the hello world sample:

  $ time dotnet run hello-world.cs > /dev/null
  
  real 0m1.161s
  user 0m0.849s
  sys 0m0.122s

  $ time dotnet run hello-world.cs > /dev/null

  real 0m0.465s  
  user 0m0.401s  
  sys 0m0.065s

jaredpar · 7 months ago
There are a lot of optimizations that we plan to add to this path. The intent of this preview was getting a functional version of `dotnet run app.cs` out the door. Items like startup optimization are going to be coming soon.
jaredpar commented on Official proposal for Type Unions in C#   github.com/dotnet/csharpl... · Posted by u/Fervicus
wackro · a year ago
What would the rough timeframe be for seeing adoption of this into the language?

I was considering introducing the OneOf library into our codebase, but if this is < a year or so away it might not be worth the effort.

jaredpar · a year ago
There is no timeframe right now. At the moment this is a loose proposal for how to approach union like features in C#. There are a lot more details to dig into here before we'd be ready to move to scheduling and implementation. Also need to decide if we take on all of the union variants proposed or just some and what priority order to approach them.
jaredpar commented on Official proposal for Type Unions in C#   github.com/dotnet/csharpl... · Posted by u/Fervicus
facturi · a year ago
That proposal doesn't mention how the union struct handles tearing under concurrent modification.

Tearing can cause memory safety issue. Variant A can have an integer field and variant B can have a reference field in the same offset. Tearing can cause it to treat an integer as reference.

jaredpar · a year ago
The design is not going to allow for struct layout to have memory safety issues when tearing is involved. That is a problem we are very well aware of and consider in designs.
jaredpar commented on Official proposal for Type Unions in C#   github.com/dotnet/csharpl... · Posted by u/Fervicus
jasomill · a year ago
Not UB, illegal. Per ECMA 335, II.10.7:

It is possible to overlap fields in this way, though offsets occupied by an object reference shall not overlap with offsets occupied by a built-in value type or a part of another object reference.

Per .NET 8.0:

  using System.Runtime.InteropServices;
  var s = new S { Bar = "Baz" };
  [StructLayout(LayoutKind.Explicit)]
  public struct S {
      [FieldOffset(0)] public UInt64 Foo;
      [FieldOffset(0)] public Object Bar;
  }
compiles, but throws

System.TypeLoadException: Could not load type 'S' from assembly 'foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because it contains an object field at offset 0 that is incorrectly aligned or overlapped by a non-object field.

Interestingly, this code elicits a warning

ILC: Method '[foo]Program.<Main>$(string[])' will always throw because: Failed to load type 'S' from assembly 'foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because of field offset '0'

from the AOT compiler, but none from the C# compiler.

jaredpar · a year ago
> from the AOT compiler, but none from the C# compiler.

The C# compiler has very little knowledge of `[FieldOffset]`. It's expected that developers understand the runtime implications of this.

jaredpar commented on A Preview of C# 8 [video]   channel9.msdn.com/Blogs/S... · Posted by u/plurby
zerr · 8 years ago
> Default Interface Implementations

So basically multiple inheritance?

jaredpar · 8 years ago
It's multiple inheritance of behavior, but not of state.
jaredpar commented on A Preview of C# 8 [video]   channel9.msdn.com/Blogs/S... · Posted by u/plurby
ajennings · 8 years ago
Very excited about the Nullable Reference Types.

Besides that, the feature I want most in C# is enum exhaustion checking. So I can write:

  enum Color { red, green, blue };
  public static string SuperheroFromColor(Color c)
  {
    if (c == Color.red)
    {
      return "Superman";
    }
    else if (c == Color.green)
    {
      return "Green Lantern";
    }
    else if (c == Color.blue)
    {
      return "Spiderman";
    }
  }
and not get a compiler error (that not all code paths return a value). But if I added "yellow" as an enum option, then I would get a compiler error. I realize that Color can be cast from an out-of-range int, so it's a little complicated. I'm willing to put something extra after the last else:

  unreachable return null;
or use a special switch statement. I just want something so the compiler checks that I have accounted for all normal enum values.

Is anyone talking about such a feature, or where would I request it? Can I write it myself as a Roslyn extension?

jaredpar · 8 years ago
There is a proposal for "sealed enums" on the C# language repo that have the semantics you are looking for.

https://github.com/dotnet/csharplang/issues/782

jaredpar commented on VsVim   visualstudiogallery.msdn.... · Posted by u/mmavnn
tkellogg · 14 years ago
Funny, I actually cloned this repo last night to contribute. I really want to contribute because it's so useful and @jaredpar seems to be doing a shit ton of work all by himself. But the whole F# part is going to be a hurdle.
jaredpar · 14 years ago
Yeah F# is a bit of a hurdle for contributors. In retrospect if I'd known I'd stick with the project this long I probably would've chosen C#.

https://github.com/jaredpar/VsVim/wiki/FAQ#wiki-language

jaredpar commented on VsVim   visualstudiogallery.msdn.... · Posted by u/mmavnn
bmj · 14 years ago
I use this daily in VS2010, and have used ViEmu in previous VS versions.

Generally, I like it, but it can be a bit sluggish at times. The only plugin I have running is JSLint, so I suspect it's VSVim causing the problems (though it only generally bogs down when I leave VS2010 for a bit). The keybindings work as one would expect. As I mentioned in a different thread, I wish it could break out of the tabbed window convention of VS and use buffers.

ViEmu did feel a bit faster (and was less prone to crashing).

jaredpar · 14 years ago
What version are you using? Prior to 1.2 there was a nasty perf bug with :hlsearch that caused it to be sluggish with 1) very large files or 2) a good number of files opened. The bug is mostly fixed in 1.2 but there are still a couple of corner cases. Those are addressed in 1.3 which will be released sometime next week. A beta drop is available here

https://github.com/downloads/jaredpar/VsVim/VsVim-1.2-Beta2....

As for crashes I'd love to hear about any you found. Feel free to send me email (hacker news alias at microsoft.com) or post an issue on github.

https://github.com/jaredpar/VsVim/issues

jaredpar commented on VsVim   visualstudiogallery.msdn.... · Posted by u/mmavnn
Stasyan · 14 years ago
I use this plugin everyday.

It's got some serious bugs that make my heart stop.

The biggest one is Undo. Looks like the plugin keeps it's own list of modifications that were performed. So when sometimes I press "u" to undo the latest change - Visual Studio gets suspended for a minute or two, and all my changes that I did since I opened Visual Studio (could be a day or a week) are pretty much gone. The work around is to close the file without saving.

jaredpar · 14 years ago
What version of VsVim are you using? There was a bug with this exact behavior in 1.1 (and possibly 1.1.1). I got it fixed for the 1.2 release which is the current version in the Visual Studio gallery.

Bug Details: https://github.com/jaredpar/VsVim/issues/672

u/jaredpar

KarmaCake day32February 3, 2012
About
C# compiler lead
View Original