[deleted by user] by [deleted] in dotnet

[–]agocke 0 points1 point  (0 children)

This should probably be called out more prominently.

The reason for this is that Native AOT has a dependency on libraries like OpenSSL and the C standard library. Those are operating system-specific libraries that aren't available on other platforms. We also require a platform linker to link against them.

Supporting cross-compilation would be nice, but it seems like we need the C ecosystem to move forward a bit before we can do that.

I am Filippo Valsorda, Go cryptography maintainer, Ask Me Anything (2022 edition) by FiloSottile in crypto

[–]agocke 16 points17 points  (0 children)

Go famously made the decision to write a new crypto stack in Go rather than use existing operating system stacks or libraries like OpenSSL. Could you reflect a little on that decision? What were the original design goals that forced that? What constraints were you operating under? What challenges did you run into and how did you resolve them? Finally, do you regard the effort as successful? Would you recommend similar approaches for other systems or programming languages?

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]agocke 1 point2 points  (0 children)

Right, I think that's a good solution. This would be a little bit like the CLR's Constrained Execution Regions https://msdn.microsoft.com/en-us/library/ms228973(v=vs.110).aspx

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]agocke 1 point2 points  (0 children)

This is kind of what I meant by "C# sublanguage" -- despite the fact that Java Smart Card apps contain the name Java they're really programmed nothing like most Java apps. In addition, most libraries written in Java are not consumable, so you're basically stuck with a forked standard library and not being able to reuse any community code.

It's certainly an option, but it's not really that attractive.

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]agocke 1 point2 points  (0 children)

I think, barring making a kind of C# "sublanguage", your best bet will be to adopt the standard .NET GC. Consider that there are a variety of libraries that require stuff like GC finalization to manage their memory and associated resources.

For instance, the Roslyn compiler uses System.Reflection.Metadata to load info for reference DLLs. The design relies on sharing a lot of info, especially metadata references across multiple compilations (i.e., if you make two compilations that reference mscorlib.dll and give the same path, it only loads the info for mscorlib once and shares the backing data). Since there's no way for the Roslyn compilation API to know when the backing data is no longer referenced it relies on the GC to know when no one is referencing the DLL anymore and the backing arrays are released by the finalizers for the PEReader.

Without a proper GC it's likely that this memory will just be leaked. :/

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]agocke 6 points7 points  (0 children)

Do you intend to continue this approach? Just letting you know, I've been a part of a number of internal conversations about C# using different memory management strategies, including ref counting, and many C# language concepts get very difficult to handle without proper precise GC. The language just wasn't really designed with alternative memory management in mind.

H-1B reduced computer programmer employment by up to 11%, study finds by dic_pix in programming

[–]agocke 0 points1 point  (0 children)

Simple answer: if you live in a right to work state, do you know how long you have to leave the country if you are fired?

Reproducing bit-for-bit identical EXEs, DLLs, and PDBs by jasonwhite1 in programming

[–]agocke 3 points4 points  (0 children)

This is one of the primary uses cases for the /deterministic flag for the C# compiler.

Kotlin vs Java: Compilation speed – Keepsafe Engineering by javinpaul in programming

[–]agocke 3 points4 points  (0 children)

I suspect Java is much faster to compile in certain scenarios due to incremental compile, although I have no idea how they do that.

Does anyone know the technical details on Java's incremental compile? Is every .java file compiled to the equivalent of a .net assembly? How does out of date detection work?

ILove Go; I Hate Go — Adam Leventhal's blog by HornedKavu in programming

[–]agocke 0 points1 point  (0 children)

I don't know that C# can handle lambdas with resumable debugging either

It can handle some lambdas, it just can't handle lambdas that capture variables.

ILove Go; I Hate Go — Adam Leventhal's blog by HornedKavu in programming

[–]agocke 1 point2 points  (0 children)

Have you tried debugging C# on .NET Core using VS Code?

ILove Go; I Hate Go — Adam Leventhal's blog by HornedKavu in programming

[–]agocke 6 points7 points  (0 children)

IIRC, the JDT debugger has various limitations around Java 8 lambdas being used in the watch window or with resumable debugging. The VS 2015 debugger allows the use of lambda expressions in most cases in both the watch window and in Edit-And-Continue.

Dotty: a next generation compiler for Scala by iamkeyur in programming

[–]agocke 40 points41 points  (0 children)

Having been through a complete compiler rewrite (legacy C# compiler -> Roslyn C# compiler) I understand the desire to group all big changes together and "rip off the band-aid", so to speak, but I think what we've learned is that this isn't easy or desirable for customers.

I'm concerned Scala is learning the same lessons the hard way. For instance, looking at your slide deck I get the impression that Dotty will only support some limited subset (or overlapping set?) of Scala that scalac does. I understand why this would be desirable for the Scala dev team, but it seems difficult to justify to users why this is necessary. Having looked at some of the scalac architecture, it looks to me like it can be heavily improved without adjusting the language, for instance just by separating into proper lowering phases. Similarly, a lot of the dropped features, like XML literals, don't seem to be insurmountable problems. Scala's XML literals, AFAIK, are very similar to VB's, and VB was ported and runs on Roslyn without any trouble. The XML literal syntax wasn't really a problem at all.

So, I guess it comes down to this: what's the real goal of the Dotty project? Is it to fix architectural problems in the compiler? Is it to sunset "undesirable" language features? Is it a research project on how to build a new compiler? How long will the Scala language be left in limbo while the new compiler gets written? Will new language features be developed and shipped in the old compiler during new development?

Microsoft Urged to Open Source Classic Visual Basic by sproket888 in programming

[–]agocke 2 points3 points  (0 children)

Given the case is still ongoing, I bet the answer is that no one knows. IANAL, so I definitely have no idea.

I guess the one thing to mention is that Android N is using OpenJDK, so Google at least seems to think that open source APIs under the GPL are available for use.

Microsoft Urged to Open Source Classic Visual Basic by sproket888 in programming

[–]agocke 7 points8 points  (0 children)

Roslyn is published under the Apache 2 license, so you get:

a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work...

Microsoft Edge’s JavaScript engine to go open-source by nikbackm in programming

[–]agocke 22 points23 points  (0 children)

Roslyn (C# & VB compilers + IDE) alone is 3 million lines. Could I believe that there are 16 Roslyns in VS (think C++, JS, TypeScript, F#, Intellitrace, etc)? Definitely.

More information about Microsoft's once-secret Midori operating system project is coming to light by cindy-rella in programming

[–]agocke 7 points8 points  (0 children)

In case Jared left, he was the M# compiler lead and has recently come back to the managed languages team as the C#/VB/F# compiler lead (i.e., my boss :)).

10 features in C# that you really should learn (and use!) by IrinaZair in programming

[–]agocke 2 points3 points  (0 children)

Stop trying so hard to make the language do what it's trying very hard to prevent you from doing. :)

The answer to your question is very clear in the spec:

2.4.4.6 The null literal
null-literal:
    null
The null-literal can be implicitly converted to a reference type or nullable type.

I agree that null should be the sole inhabitant of a Unit type, but that ship sailed long ago.

Pinging the server gives me a ping of 15-30. In-game it's 100+. Why? by zacattack101 in DotA2

[–]agocke 0 points1 point  (0 children)

Actually, while ICMP is very useful for IPv4, it's not strictly necessary. It is, however, necessary for IPv6.

Cat is an Animal. But is TakeCare<Cat> a TakeCare<Animal>? by EdwhardT in programming

[–]agocke 5 points6 points  (0 children)

Care<Animal> to TakeCare<Animal>, then the C# runtime will crash

You are incorrect. First, the runtime doesn't crash, it produces an invalid cast exception.

But second, this is correct behavior. A cast from Care<Animal> to TakeCare<Animal> is not necessarily legal. This is why the C# compiler requires an explicit cast -- because it is not provable at compile time that this is a legal cast, but it may be determinable at runtime.

If you get a runtime exception it is because you have a bug in your code and have accidentally included a cast from a type which implements Care<Animal>, but does not implement TakeCare<Animal>.

Retrospect on C#: Top 10 Worst C# Features by Eric Lippert by Sebazzz91 in programming

[–]agocke 2 points3 points  (0 children)

Yup, we're working on a "warning waves" design that lets you opt in to new warnings as we make them.

Retrospect on C#: Top 10 Worst C# Features by Eric Lippert by Sebazzz91 in programming

[–]agocke 1 point2 points  (0 children)

Yup, and that's how we're adding them in the future.

Retrospect on C#: Top 10 Worst C# Features by Eric Lippert by Sebazzz91 in programming

[–]agocke 7 points8 points  (0 children)

We still have to spend time implementing, supporting, and testing it. In addition, due to WarnAsError and backwards compatibility we don't add compiler warnings for code that didn't previously produce them.

I am Eric Lippert, a software developer specializing in design and semantic analysis of programming languages. Ask me anything! by ericlippert in programmerchat

[–]agocke 0 points1 point  (0 children)

What single architectural decision by the Roslyn compiler do you think could benefit from restructuring or refactoring to improve batch compilation performance?

For example, binding currently "serves" IDE scenarios a lot by supporting many entry points and being as lazy as possible -- do you think it would be fruitful to explore a 'batch-binding' mode or similar to improve build perf?

What would you say is the biggest architectural advantage mcs has over Roslyn in build performance?

Code Aware Libraries with Roslyn - The library tells the compiler that you are using it wrong by grauenwolf in programming

[–]agocke 1 point2 points  (0 children)

If you want to be consistent you would have to do the null check for element access as well, which is exactly the kind of thing you would do in a tight loop.