frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

List of unproven and disproven cancer treatments

https://en.wikipedia.org/wiki/List_of_unproven_and_disproven_cancer_treatments
1•brightbeige•41s ago•0 comments

Me/CFS: The blind spot in proactive medicine (Open Letter)

https://github.com/debugmeplease/debug-ME
1•debugmeplease•1m ago•1 comments

Ask HN: What are the word games do you play everyday?

1•gogo61•3m ago•0 comments

Show HN: Paper Arena – A social trading feed where only AI agents can post

https://paperinvest.io/arena
1•andrenorman•5m ago•0 comments

TOSTracker – The AI Training Asymmetry

https://tostracker.app/analysis/ai-training
1•tldrthelaw•9m ago•0 comments

The Devil Inside GitHub

https://blog.melashri.net/micro/github-devil/
2•elashri•9m ago•0 comments

Show HN: Distill – Migrate LLM agents from expensive to cheap models

https://github.com/ricardomoratomateos/distill
1•ricardomorato•9m ago•0 comments

Show HN: Sigma Runtime – Maintaining 100% Fact Integrity over 120 LLM Cycles

https://github.com/sigmastratum/documentation/tree/main/sigma-runtime/SR-053
1•teugent•10m ago•0 comments

Make a local open-source AI chatbot with access to Fedora documentation

https://fedoramagazine.org/how-to-make-a-local-open-source-ai-chatbot-who-has-access-to-fedora-do...
1•jadedtuna•11m ago•0 comments

Introduce the Vouch/Denouncement Contribution Model by Mitchellh

https://github.com/ghostty-org/ghostty/pull/10559
1•samtrack2019•11m ago•0 comments

Software Factories and the Agentic Moment

https://factory.strongdm.ai/
1•mellosouls•12m ago•1 comments

The Neuroscience Behind Nutrition for Developers and Founders

https://comuniq.xyz/post?t=797
1•01-_-•12m ago•0 comments

Bang bang he murdered math {the musical } (2024)

https://taylor.town/bang-bang
1•surprisetalk•12m ago•0 comments

A Night Without the Nerds – Claude Opus 4.6, Field-Tested

https://konfuzio.com/en/a-night-without-the-nerds-claude-opus-4-6-in-the-field-test/
1•konfuzio•14m ago•0 comments

Could ionospheric disturbances influence earthquakes?

https://www.kyoto-u.ac.jp/en/research-news/2026-02-06-0
2•geox•16m ago•1 comments

SpaceX's next astronaut launch for NASA is officially on for Feb. 11 as FAA clea

https://www.space.com/space-exploration/launches-spacecraft/spacexs-next-astronaut-launch-for-nas...
1•bookmtn•17m ago•0 comments

Show HN: One-click AI employee with its own cloud desktop

https://cloudbot-ai.com
2•fainir•19m ago•0 comments

Show HN: Poddley – Search podcasts by who's speaking

https://poddley.com
1•onesandofgrain•20m ago•0 comments

Same Surface, Different Weight

https://www.robpanico.com/articles/display/?entry_short=same-surface-different-weight
1•retrocog•23m ago•0 comments

The Rise of Spec Driven Development

https://www.dbreunig.com/2026/02/06/the-rise-of-spec-driven-development.html
2•Brajeshwar•27m ago•0 comments

The first good Raspberry Pi Laptop

https://www.jeffgeerling.com/blog/2026/the-first-good-raspberry-pi-laptop/
3•Brajeshwar•27m ago•0 comments

Seas to Rise Around the World – But Not in Greenland

https://e360.yale.edu/digest/greenland-sea-levels-fall
2•Brajeshwar•27m ago•0 comments

Will Future Generations Think We're Gross?

https://chillphysicsenjoyer.substack.com/p/will-future-generations-think-were
1•crescit_eundo•30m ago•1 comments

State Department will delete Xitter posts from before Trump returned to office

https://www.npr.org/2026/02/07/nx-s1-5704785/state-department-trump-posts-x
2•righthand•33m ago•1 comments

Show HN: Verifiable server roundtrip demo for a decision interruption system

https://github.com/veeduzyl-hue/decision-assistant-roundtrip-demo
1•veeduzyl•34m ago•0 comments

Impl Rust – Avro IDL Tool in Rust via Antlr

https://www.youtube.com/watch?v=vmKvw73V394
1•todsacerdoti•34m ago•0 comments

Stories from 25 Years of Software Development

https://susam.net/twenty-five-years-of-computing.html
3•vinhnx•35m ago•0 comments

minikeyvalue

https://github.com/commaai/minikeyvalue/tree/prod
3•tosh•40m ago•0 comments

Neomacs: GPU-accelerated Emacs with inline video, WebKit, and terminal via wgpu

https://github.com/eval-exec/neomacs
1•evalexec•45m ago•0 comments

Show HN: Moli P2P – An ephemeral, serverless image gallery (Rust and WebRTC)

https://moli-green.is/
2•ShinyaKoyano•49m ago•1 comments
Open in hackernews

Nullable vs. Nullable in C#

https://einarwh.no/blog/2025/08/25/nullable-vs-nullable/
66•Bogdanp•5mo ago

Comments

manuc66•5mo ago
@Bogdanp maybe this is another way to express it:

public static class EnumerableExtensions {

public static IEnumerable<TR> SelectNotNull<T, TR>( this IEnumerable<T> source, Func<T, TR?> fn) where TR : class { return source.Select(fn) .Where(it => it != null) .OfType<T>(); }

public static IEnumerable<TR> SelectNotNull<T, TR>( this IEnumerable<T> source, Func<T, TR?> fn) where TR : struct { return source.Select(fn) .Where(it => it != null) .Select(item => item.Value); } }

Uvix•5mo ago
Both look like they’ll work. For the struct case I think yours is better. For the class case I think using Cast() like the original instead of OfType() makes more sense - you don’t need to filter out other types from the enumerable, so cast once instead of casting then performing a useless check on the result.
nick_•5mo ago
I'm pretty sure you only need the OfType call. It filters out nulls already.
Dwedit•5mo ago
Please remove the uppercase on the second "Nullable" in the headline.
jibal•5mo ago
> to denote two completely separate concepts

No, same concept ... you're making a mistake that some call "implementation on the brain". That they're the same concept is why you're able to specify a common operation, SelectNotNull. That you had to provide an explicit type constraint that a compiler should be able to infer doesn't change that.

dmatech•5mo ago
This is why it's absolutely essential to always be aware of which types are value types in the .NET type system. Attempts by either users or the designers to conflate or unify them are ill-conceived. The nullability semantics could have been kept consistent if they went all the way back to the beginning of the CLR and did it that way, but this would have not been consistent with Java's JVM and type system (which they were trying to mimic).

That said, we already have value types like System.Int32 which inherit from System.ValueType (an abstract type) which inherits from System.Object (a non-abstract reference type), so things are already a bit weird.

bob1029•5mo ago
> That said, we already have value types like System.Int32 which inherit from System.ValueType (an abstract type) which inherits from System.Object (a non-abstract reference type), so things are already a bit weird.

But it all works, right? The runtime can do anything it wants to with the IL. The handling of Vector<T> is a good example of this - Locating arbitrary types/namespaces and emitting special instructions based upon the current machine's capabilities. Normalizing value vs reference semantics would be a tiny drop in this bucket.

dmatech•5mo ago
There's some really interesting stuff about how that works here:

https://stackoverflow.com/a/56392846/7077511

tialaramex•5mo ago
It is in hindsight unfortunate that this idea didn't get into the CLR itself.

The blog post doesn't mention this, but whereas if I say my function only takes this 32-bit signed integer value type, a VB.NET caller can't hand it "null" because that's not a 32-bit signed integer - if instead I say it takes string (not the nullable string?) too bad, the VB.NET caller can just pass null anyway because in the CLR there's no distinction.

You're actually expected (if you provide public surface) to write a null test, in your C# code which explicitly says in the function signature that this mustn't be null, otherwise it might blow up at runtime because the CLR doesn't care.

pjmlp•5mo ago
Nullable types came into C# during the .NET Framework days, back when the team had very high bar to ever add features that would change the runtime as OS component.

Hence why async/await is such a mess of IL bytecode, as it was implemented in userspace so to say.

Only with .NET Core, they followed other languages in not tying the runtime to the OS, a lesson that Google also had to learn (ART is updatable via PlayStore since Android 12).

pjmlp•5mo ago
The class/struct approach predates C#.

For example in Eiffel by default they are references, but can also be turned into value types if the are blesses ones like numeric types, or if the developer tags them as expanded classes, either at definition or declaration type.

Delphi makes the distinction between classical object, and records from Object Pascal (both value based, and explicit pointers are required), or class types, heap only.

Modula-3 classes and records also follow similar approach, OBJECT follows the same semantic model of REF RECORDS.

For more modern examples, also D and Swift follow this approach.

And plenty of other examples for anyone wanting to dive into SIGPLAN.

estimator7292•5mo ago
Truthfully I think the language lost something critically important when we went gung-ho on purging ourselves of the EVILS! of nullable types.

Back in the Paleolithic, the only way to get a nullable value type was to extremely explicitly box it into a Nullable<T>. The distinction between value and reference types was crystal clear and unmistakable. Boxing values required an active and deliberate decision.

Now I guess we just box everything because null checks are hard or something.

awalsh128•5mo ago
C# doesn't box value types and can be treated like an object semantically for things like generics.

IMO, we should just do away with nullability and use the optional/maybe approach as wrappers for potential values. Null shouldn't really exist ideally, especially in OO because it is a unit value and also the parent value for all objects. I appreciate nullability being introduced but it causes a fork in types by two branches at the top of the hierarchy in most cases and more conceptually just associates these optionals with this flawed concept.

CrimsonCape•5mo ago
I wonder if anybody has tried inheriting from System.ValueType or System.Object...I need to fire up an IDE and see what kind of virtuals and abstracts are exposed by doing so. If even possible.

It seems like an inheritance hierarchy build upon abstract classes that provide no usable interface just means "hey we need this inheritance for...reasons... cause its legacy!" on the one hand, and "we can rip all this useless ** out" on the other hand.

estimator7292•5mo ago
As I understand, all types implicitly inherit from Object in C#. That's where the `ToString` and hashcode overrides come from.

Offhand, I'd guess that explicitly inheriting from Object would either do nothing or fail to compile depending on where in the type hierarchy you are.

Similarly, all structs implicitly inherit from ValueType. That's what structs are in C#.

orthoxerox•5mo ago
OP's code only works because the method goes from T? to T. If it accepted T and returned T?, he would've gotten an error like this:

   CS0111: Type 'Utils' already defines a member called 'Foo' with the same parameter types
That's because the "type constraints are part of the signature of the method and there is no ambiguity" statement is wrong. They are not.
mrcsharp•5mo ago
As a side note: please avoid, as much as possible, putting `.Select(..)` before `.Where(..)`. You are wasting CPU cycles and memory space by forcing LINQ to map all the items and then filtering on the mapped value.

In most situations, you should be able to filter on the source enumerable before mapping making the whole thing more efficient.

Additionally, that `.Cast<TR>(..)` at the end should have been a dead giveaway that you are going down the wrong path here. You are incurring even more CPU and Memory costs as the `.Cast<TR>(..)` call will now iterate through all the items needlessly.[1]

Also, the design of this this method doesn't seem to make much difference to me anyways:

``` var strs = source.SelectNotNull(it => it); ```

vs

``` var strs = source.Where(it => it != null); ```

A lot of other LINQ extension methods allow you to pass in a predicate expression that will be executed on the source enumerable:

``` var str = source.First(it => it != null); ```

[1] https://source.dot.net/#System.Linq/System/Linq/Cast.cs,152b...

LtWorf•5mo ago
If I was able to write a simple optimiser for relational algebra, I'm sure microsoft engineers can come up with something :D
angrysaki•5mo ago
>Also, the design of this this method doesn't seem to make much difference to me anyways:

``` var strs = source.SelectNotNull(it => it); ```

vs

``` var strs = source.Where(it => it != null); ```

Wouldn't the first be IEnumerable<TR> and the second be IEnumerable<TR?>

I imagine that's the main driver for creating SelectNotNull, so that you get the nonnullable type out of the Linq query

mrcsharp•5mo ago
> I imagine that's the main driver for creating SelectNotNull

Sure. And now we are fighting the compiler and in the process writing less efficient code.

The compiler gives us a way to deal with this situation. It is all about being absolutely clear with intentions. Yes, Where(..) in my example would return IEnumerable<TR?> but then in subsequent code I can tell the compiler that I know for a fact that TR? is actually TR by using the null forgiving operator (!).

angrysaki•5mo ago
>The compiler gives us a way to deal with this situation. It is all about being absolutely clear with intentions. Yes, Where(..) in my example would return IEnumerable<TR?> but then in subsequent code I can tell the compiler that I know for a fact that TR? is actually TR by using the null forgiving operator (!).

I guess that seems way less clear with intentions to me. If I have an array of potentially null types and I want to filter out the not nulls, I'd much rather have an operation that returns a T[] vs a T?[].

I should also note that I also have a "IEnumerable<T> WhereNotNull(IEnumerable<T>?)" function in my codebase, but I implemented it using a foreach/yield which doesn't suffer from the extra Cast<>()

meow_cat•5mo ago
I actually use OfType<TR> to remove null elements as suggested by the doc. https://learn.microsoft.com/en-us/dotnet/api/system.linq.enu... Performance-wise, where is this situated?
chrisoverzero•5mo ago
> Luckily, since type constraints are part of the signature of the method and there is no ambiguity, I am allowed to make this overload.

This isn’t the case. It’s allowed because the question-mark syntax means two different things in value- and reference-type contexts. The signatures really look like this:

    public static IEnumerable<TR> SelectNotNull<T, TR>(
      this IEnumerable<T> source,
      Func<T, TR> fn)
      where TR : class // …and the nullability of TR is tracked by the compiler

    public static IEnumerable<TR> SelectNotNull<T, TR>(
      this IEnumerable<T> source,
      Func<T, Nullable<TR>> fn)
      where TR : struct
This is an allowable overload.
bazoom42•5mo ago
Nullability on refererence types is boltet on in an ugly way in C#. Still a very valuable feature though.
gwbas1c•5mo ago
Uhm: There is the OfType method that is generally used to filter an IEnumerable<T?> to IEnumerable<T>. It doesn't care about reference vs value types, because it doesn't compare to null. Instead it checks the type of each element.

Why? If you have an value, foo, that's declared "int?", (foo is int) evaluates to if there is a value present, and false if there is no value present. The same thing happens if foo is declared as string?.

BTW: I checked if the overload can be avoided by using the "default" keyword. It can't.