Live data from Hacker News

An update on Dart macros and data serialization

medium.com

71–80 of 125 posts

Re: An update on Dart macros and data serialization

#71
post #50
post #35

Earlier quoted context omitted.

[Flutter founder here.] I'm pretty sure we did look at C# (and certainly a whole bunch of other languages). I don't actually recall why we didn't use C# at the time. I remember Go binaries were waaay to big, JS (what we originally wrote Flutter in) startup time was way too slow on iOS, Swift was too deeply tied to Apple (the standard library was closed source at that time), etc. It's possible that C# was too verbose…

I'm not going to log in to Xitter to read the rest of his tweets, but it doesn't seem like Miguel regrets using C# or is particularly in love with Dart. He's very complimentary of the goals and governance of Flutter, which is certainly more important than a language choice between two respectable languages. I do think C# is by far the best mainstream language, but good IDE support and library ecosystem are the dealma…

    > I do think C# is by far the best mainstream language
C# is a hugely underrated language that I feel like often gets overlooked when teams look to move beyond JS/TS. The language has a pretty tight syntactic congruency to JS/TS[0], Entity Framework is pretty amazing in terms of DX/perf/maturity, and it seems like we should see more C#/.NET it in the wild than we actually do.

My sense is that there are some legitimate reasons to pick something like Kotlin (JVM ecosystem), but a lot of folks that might have worked with C# in passing in the .NET Framework days simply haven't given the ecosystem another look. It's productive, stable, performant, and secure.

VS Code support is really good and Rider has a community license available.

[0] https://github.com/CharlieDigital/js-ts-csharp

Re: An update on Dart macros and data serialization

#72
post #48

Earlier quoted context omitted.

C# was Microsoft's attempt to learn from Java's mistakes, which they very much succeeded at doing.

That's not even remotely historic accurate. Sun vs Microsoft drove MS into creating C#. Please don't fan boy to the point of lying.

It's much much more complicated than that. Sun refused to add many language features that Microsoft (then a cautious but also genuine user of Java) wanted. Such as refusal to add delegates/closures:

https://benhutchison.wordpress.com/2009/02/14/suns-rejection... https://stackoverflow.com/questions/1973579/why-doesnt-java-...

J++, which was Microsoft's Java implementation in the 90's added a few language extensions that were clearly not Sun-approved, but driven by internal engineering feedback at MS. C# having struct and class keywords, allowing you to define your own value types, is clearly a result of that missing in Java, which still in 2025 has no such equivalent yet.

Also Java's then native code interop solution, JNI, was and still remains complete garbage, and it's flaws were a huge guide for Microsoft when they deveoped .NET and it's native interop equivalent, PI (platform invoke).

Thankfully, Java now have FFM [foreign function and memory APIs](https://docs.oracle.com/en/java/javase/21/core/foreign-funct...) APIs (and also JNA which is community driven), which are much better than JNI.

Re: An update on Dart macros and data serialization

#73
post #24
post #4

This is good news. The dart language has been getting more complicated without corresponding quality of life improvements. A first class record object without messing around with macros would be a great start.

Why is it that many languages, at the start, don't have support for records/plain structs?

Because implementing them is tedious, and you can always simulate them with simpler aggregation methods, or possibly lexical closures.

When the language implementors start making larger programs, it will soon become apparent how the program organization is hampered without named, defined data structures.

I didn't add structs to TXR Lisp until August 2015, a full six years from the start of the project. I don't remember it being all that much fun, except when I changed my mind about single inheritance and went multiple. The first commit for that was in December 2019.

Another fun thing was inventing a macro system for defstruct, allowing new kinds of clauses to be written that can be used inside defstruct. Then using them to write a delegation mechanism in the form of :delegate and :mass-delegate clauses, whereby you can declare individual methods, or a swath of them, to delegate through another object.

Re: An update on Dart macros and data serialization

#74
post #31

I think after reading through the blog post the reasons they have made a whole lot of sense and sounded like that of a mature engineering team to me. There are a bunch of other interesting approaches here they can look at. Improving the code generation story more generally, shopping the augmentations feature (basically C#’s partial classes) and getting more serious about serialization all feel like sensible direction…

This sounds like they were going for a Roslyn analogue (using Dart to generate Dart the same way Roslyn uses C# to generate C#). Definitely a big time investment.

It's a big bite to chew, but I think Roslyn has paid big dividends.

Re: An update on Dart macros and data serialization

#75
post #64

Earlier quoted context omitted.

I guess that at the time you started developing Flutter C#'s hot reload, source generators and NativeAOT compilation didn't yet exist or were just introduced and incomplete.

We started Flutter in 2014 and made the decision to switch to Dart in ~Jan 2015 iirc.

So before .NET Core 1.0. In 2015 C# still mainly targeted only MS platforms (ignoring Mono) and didn't have mentioned features yet.

I know that Dart started as an alternative to JS, but it seems like JS target is now (unnecessarily) limiting Dart language in a way. I would be nice to be able to use lists of structs or a proper uint64 when needed. As a language it needs to expand in both directions to compete: high level productivity features and low level performance features. It has potential, but it's not there yet.

If Dart would find more use cases besides Flutter, it would make more sense to invest in its ecosystem.

Re: An update on Dart macros and data serialization

#76
post #44

What will the Dart team focus on instead? I wish the cross-compilation issue was taken to a higher priority, I mean Flutter already kinda of solved it.

They talk about it some in the post, but my understanding is they're going to see if the can solve some of the motivating problems (e.g. json serialization) with simpler one-off solutions rather than a big general language feature.

Oh okey

Re: An update on Dart macros and data serialization

#77

Earlier quoted context omitted.

>They should have just use C# for Flutter. Dear lord no. We don't need more C# in the world. >It supports ahead-of-time compilation and hot-reload. In name only. Doesn't really well in practice. Go and just look for "C# hot reload not working" in any search engine and look at the variety of contexts it just simply does not work with no resolution.

C# is a fantastic language that has, in recent years, evolved very quickly for the better. Nice mix of object and functional drawing a lot of influence from F#. It shares a lot of language constructs with TypeScript (and by extension, JS) and has been converging with each release so I'm often surprised that people hate on it or that more startups don't reach for it if they are on Node with TS. Same syntax for key lan…

The improvements are great for people who have to or want to use C# for whatever reason? But how does that move the needle from other tech-stacks that are for more capable, especially on non-Windows environments (and please don't imply that C# is truly cross-platform, it's fine for web API's, it's not fine when dealing with actual system calls).

If you're within the Windows garden, those tools certainly make sense to use. But if you're not, there just simply isn't a reason to burden your app/platform with them.

To be clear, there's nothing wrong with C#, but the advocacy for it tends to be quite loud and passionate without much technical clarity in what it brings to the table that's lacking in other ecosystems. And again, you might be in for a world of hurt depending on how complex your needs are.

Re: An update on Dart macros and data serialization

#78

Earlier quoted context omitted.

That's not even remotely historic accurate. Sun vs Microsoft drove MS into creating C#. Please don't fan boy to the point of lying.

It's much much more complicated than that. Sun refused to add many language features that Microsoft (then a cautious but also genuine user of Java) wanted. Such as refusal to add delegates/closures: https://benhutchison.wordpress.com/2009/02/14/suns-rejection... https://stackoverflow.com/questions/1973579/why-doesnt-java-... J++, which was Microsoft's Java implementation in the 90's added a few language extensions th…

The key point is that C# was happening regardless of whatever technical upsides people wanted to see out of it. C# would still exist today and still be just as popular in the Windows ecosystem even if it made all the same exact mistakes as Java.

Re: An update on Dart macros and data serialization

#79
post #64

Earlier quoted context omitted.

We started Flutter in 2014 and made the decision to switch to Dart in ~Jan 2015 iirc.

So before .NET Core 1.0. In 2015 C# still mainly targeted only MS platforms (ignoring Mono) and didn't have mentioned features yet. I know that Dart started as an alternative to JS, but it seems like JS target is now (unnecessarily) limiting Dart language in a way. I would be nice to be able to use lists of structs or a proper uint64 when needed. As a language it needs to expand in both directions to compete: high le…

I think you're not wrong about JS target being unnecessarily limiting. The problem is that a 250B/year business is written on top of Dart's JS transpiler (Google Ads) so it seems unlikely to be removed from the language anytime soon (maybe Dart2Wasm could allow that?).

It's pretty neat that Dart's JS support means you can take your code (e.g Flutter app) to the web, but I think that whole aspect of the ecosystem is underexplored/underdeveloped as of yet.

Re: An update on Dart macros and data serialization

#80
post #37

They should have just use C# for Flutter. Without investing significant time, like they did with Dart, they would have a language with a much bigger ecosystem that is faster, already has compile time code generation and better support for data than Dart. It supports ahead-of-time compilation and hot-reload. The only feature missing in C# is compilation to JS, but with WASM is that really needed? Biggest downside of C…

I think Go would have been the most logical choice, given that it's Google.

We considered Go! At the time it was much more designed for servers than mobile devices. If I recall correctly the minimum binary size was like 30mb or something.
Post reply on HN