frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Decompiling the New C# 14 field Keyword

https://blog.ivankahl.com/decompiling-the-new-csharp-14-field-keyword/
28•ivankahl•4d ago

Comments

drysart•1h ago
All of the caveats basically boil down to "if you need to access the private backing field from anywhere other than the property getter/setter; then be aware it's going to have a funky non C# compliant field name".

In the EF Core and Automapper type of cases, I consider it an anti-pattern that something outside the class is taking a dependency on a private member of the class in the first place, so the compiler is really doing you a favor by hiding away the private backing field more obscurely.

pwdisswordfishy•33m ago
I'm surprised there isn't something pseudorandom thrown in for good measure – like a few digits of a hash of the source file.
Kwpolska•1h ago
> If you want to avoid this issue altogether, consider using a source generator library like Mapster. That way, mapping issues can be caught at build time rather than at runtime.

The only winning move is not to play. Mapping libraries, even with source generators, produce lots of bugs and surprising behavior. Just write mappers by hand.

mrsmrtss•1h ago
Agree, mapping libraries make things only more complicated and harder to debug.
politelemon•1h ago
I can appreciate the steady syntactic sugar that c# has been introducing these past years, they never feel like an abrupt departure from the consistency throughout. I often think that this is what java could have been if it hadn't been mangled by oracle's influence, unfortunately as much I like java it's pretty obvious that different parts have been designed by disjointed committee members focused on just one thing.
materialpoint•8m ago
This started long before Oracle and the favouring of verbose, ritualistic boiler code was set back at Sun. James Gosling has been staunchly against overloading operators, properties and value types (almost out of spite from Microsoft's success with providing this in C#), the aftermath of which the language and run-time still struggle today and forever will. It's unfortunate that the original inventor, while a brilliant programmer himself, thought so little of others that such features were not to be included, because other programmers might mess up their use.
twoodfin•34m ago
How does C# the language or C# the language standard evolution process accommodate a new keyword with such a generic name? Is it context-dependent?
lillecarl•28m ago
Yes, you have to use field as the backing variable name in a property. The article is pretty clear about its usage.
kkukshtel•25m ago
This is the first time they've done this in a long time fwiw. So the answer is "they usually never worry about this because it never happens".

That said, they will also throw compiler warnings in console during build if you are using an all lowercase word with some small number of characters. I don't remember the exact trigger or warning, but it says something like "such words may be reserved for future use by the compiler" to disincentivize use.

janjones•23m ago
Yes, it's contextual. There is more details in this section of the article: Naming Conflicts with Existing Class Members
twoodfin•6m ago
Thanks, my bad. I didn’t continue reading past the sections on Entity Framework and AutoMapper.
estimator7292•11m ago
It's been a while, but from memory I think C# allows you to override keywords and use them as variable names when prefixed with @

The compiler knows what you're doing. A keyword like 'field's inside a function's braces just isn't valid. Putting 'field' after a type name in a variable declaration makes as much sense as 'private int class;'

Coarse Is Better

https://borretti.me/article/coarse-is-better
84•_dain_•2h ago•34 comments

ARIN Public Incident Report – 4.10 Misissuance Error

https://www.arin.net/announcements/20251212/
14•immibis•25m ago•1 comments

Show HN: Shittp – Volatile Dotfiles over SSH

https://github.com/FOBshippingpoint/shittp
78•sdovan1•3h ago•35 comments

Structured Outputs Create False Confidence

https://boundaryml.com/blog/structured-outputs-create-false-confidence
11•gmays•38m ago•1 comments

Three Ways to Solve Problems

https://andreasfragner.com/writing/three-ways-to-solve-problems
24•42point2•1h ago•3 comments

Show HN: Jmail – Google Suite for Epstein files

https://www.jmail.world
1118•lukeigel•18h ago•246 comments

E.W.Dijkstra Archive

https://www.cs.utexas.edu/~EWD/welcome.html
4•surprisetalk•15m ago•0 comments

Backing up Spotify

https://annas-archive.li/blog/backing-up-spotify.html
1511•vitplister•21h ago•508 comments

Ruby website redesigned

https://www.ruby-lang.org/en/
216•psxuaw•8h ago•71 comments

Indoor tanning makes youthful skin much older on a genetic level

https://www.ucsf.edu/news/2025/12/431206/indoor-tanning-makes-youthful-skin-much-older-genetic-level
122•SanjayMehta•10h ago•66 comments

Measuring AI Ability to Complete Long Tasks

https://metr.org/blog/2025-03-19-measuring-ai-ability-to-complete-long-tasks/
184•spicypete•11h ago•123 comments

Decompiling the New C# 14 field Keyword

https://blog.ivankahl.com/decompiling-the-new-csharp-14-field-keyword/
28•ivankahl•4d ago•12 comments

Show HN: The Official National Train Map Sucked, So I Made My Own

https://www.bdzmap.com/
22•Pavlinbg•3h ago•5 comments

Go ahead, self-host Postgres

https://pierce.dev/notes/go-ahead-self-host-postgres#user-content-fn-1
598•pavel_lishin•1d ago•345 comments

The uncertain origins of aspirin

https://www.asimov.press/p/aspirin
34•dearwell•4d ago•7 comments

Claude in Chrome

https://claude.com/chrome
245•ianrahman•18h ago•131 comments

Ireland’s Diarmuid Early wins world Microsoft Excel title

https://www.bbc.com/news/articles/cj4qzgvxxgvo
267•1659447091•19h ago•90 comments

Isengard in Oxford

https://lareviewofbooks.org/article/isengard-in-oxford/
82•lermontov•10h ago•10 comments

Inca Stone Masonry

https://www.earthasweknowit.com/pages/inca_construction
95•jppope•8h ago•28 comments

What I Learned About Deploying AV1 from Two Deployers

https://streaminglearningcenter.com/articles/what-i-learned-about-deploying-av1-from-two-deployer...
3•breve•5d ago•0 comments

Log level 'error' should mean that something needs to be fixed

https://utcc.utoronto.ca/~cks/space/blog/programming/ErrorsShouldRequireFixing
426•todsacerdoti•4d ago•270 comments

Pure Silicon Demo Coding: No CPU, No Memory, Just 4k Gates

https://www.a1k0n.net/2025/12/19/tiny-tapeout-demo.html
381•a1k0n•22h ago•60 comments

William Golding's Island of Savagery

https://www.historytoday.com/archive/portrait-author-historian/william-goldings-island-savagery
14•samclemens•12h ago•8 comments

Modalz Modalz Modalz (2018)

https://modalzmodalzmodalz.com/
21•iamwil•5d ago•8 comments

OpenSCAD is kinda neat

https://nuxx.net/blog/2025/12/20/openscad-is-kinda-neat/
276•c0nsumer•21h ago•210 comments

Big GPUs don't need big PCs

https://www.jeffgeerling.com/blog/2025/big-gpus-dont-need-big-pcs
248•mikece•21h ago•105 comments

New mathematical framework reshapes debate over simulation hypothesis

https://www.santafe.edu/news-center/news/new-mathematical-framework-reshapes-debate-over-simulati...
50•Gooblebrai•4h ago•58 comments

Show HN: RenderCV – Open-source CV/resume generator, YAML → PDF

https://github.com/rendercv/rendercv
5•sinaatalay•2h ago•0 comments

Show HN: Mushak – Zero config zero downtime Docker/Compose to server deployment

https://mushak.sh
3•hmontazeri•2h ago•3 comments

Show HN: HN Wrapped 2025 - an LLM reviews your year on HN

https://hn-wrapped.kadoa.com?year=2025
245•hubraumhugo•1d ago•131 comments