Live data from Hacker News

An update on Dart macros and data serialization

medium.com

21–30 of 125 posts

Re: An update on Dart macros and data serialization

#21
post #18
post #9

Earlier quoted context omitted.

in Scheme you can redefine `define` to be number 5. Easy to implement, but a nightmare in real world scenarios [0]. That's why languages like Go became popular, they're trashy, boring, and dumb, but that's exactly what's needed in big projects. [0]: imagine your colleague wrote a macro that redefines for loops because at the time, it made life easier for him.

> in Scheme you can redefine `define` to be number 5. This is like asking "what if your coworker named all errs as `ok`" so everything was `if ok { return errors.New("Not ok!!"); }`. It's possible but no one does it. This is why `defmacro` and `gensym` in common lisp are awesome, and similarly why Go's warts don't matter. Much of programming language ugliness is an "impact x frequency" calculation, rather than one or…

"No one does it" is extremely relative. Take your closing remark about JavaScript: I don't run into JS warts very often at all, and I'm a professional web developer who works in it day in and day out. I guess my team just doesn't do dumb JS stuff?

But apparently lots of other people do run into them regularly, so I believe that such things do exist.

By the same token, I've heard countless reports of people struggling with the flexibility that Lisp offers, with co-workers who abuse it to create nightmarish situations. That you haven't experienced that doesn't mean no one does.

Re: An update on Dart macros and data serialization

#22

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…

And Microsoft should have just used Java.

Re: An update on Dart macros and data serialization

#23
post #7

Why is it that Lisp family macros are easy to implement and use, but not so in other languages?

Are Lisp macros easy to use? My understanding was that Lisp code is notoriously difficult to understand if you didn't write it, largely because of the obscenely powerful macro system that makes it too easy to be too clever. Which is essentially the same complaint that everyone has about every macro system.

I’ve been working with Common Lisp for about ten years now and I’ve never found that this criticism matches the reality of working on lisp codebases.

Re: An update on Dart macros and data serialization

#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?

Re: An update on Dart macros and data serialization

#25

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…

Dart's awesome.

I'm sure C# is too.

I've been unlucky enough to have many years in on both iOS and Android, and Dart is a fantastic language, far better than both incumbents.

I worry about judging it as a whole, based solely on their ability to launch pre-compile time code generation that is faster than their current approach.

Macros seemed really cool + really difficult to improve past the current codegen.

I have a 35K LOC "main" code base that generates 670K lines of code under the current approach. It takes 52 seconds for a cold generation of all 670K. Seconds for warm. shrugs (sounds great to me)

Re: An update on Dart macros and data serialization

#26
post #3

Former Eng. Dir for Dart, co-founder of Flutter, here. I'd like to believe this is a good thing for the Dart project, but only time will tell. My hot take here: https://shorebird.dev/blog/dart-macros/

Thanks, good take. Especially if some of the pieces are still being added.

In my humble opinion, you can handle many cases like serialization better with 'compileTime' or comptime features though I'm partial to macros. Especially with core compile time constructs like 'fields' [1, 2]. Though those require some abilities dart's compiler may not have or be able to do efficiently. That'd be a bummer, as even C++ is finally getting compile time reflection.

1: https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT 2: https://www.openmymind.net/Basic-MetaProgramming-in-Zig/

Re: An update on Dart macros and data serialization

#27
post #22

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…

And Microsoft should have just used Java.

And Java should have just been C++ with a really nice garbage collector

Re: An update on Dart macros and data serialization

#28
post #5

Maybe it's time to just recognize that lisp-style macros-as-language-syntax features just aren't worth the struggle and grief? The big metaprogramming feature traditionally implemented in macros, type generation, is already provided in some form by all major languages already. And an awful lot (and I mean an awful lot) of good work can be done at the string replacement level with cpp. And generating code upstream of…

In another world, macros could have filled the role that programmable yaml fills today.

|-

  help  

  me

Re: An update on Dart macros and data serialization

#29
post #22

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…

And Microsoft should have just used Java.

Genuine question, is this comparison really apples to apples? Microsoft wanted to compete with sun right? Does google want to compete with programming languages like this? My gut tells me this is NIH not wanting to compete.
Post reply on HN