Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's not really true.

Source generation is used at some level to implement expressivity at minimal runtime cost. It's just operating at a different level of abstraction to make different tradeoffs.

Whether you do Foo.Serialize() and it uses reflection to enumerate the properties, carries around tags permanently or it uses some compiletime generated function has nothing much to do with expressiveness.

If you design around a Foo<bar> does it matter if behind the scenes it generates a FooOfBar?

Should a language inherently care specifically about protobufs, flatbuffers, capnproto, etc because expressiveness or should it just have capable source generators for building strongly typed interfaces without the legwork? Are you sure an alternative implementation which is more expressive would be better or would it just be different?



That is really true, it is a workaround to avoid designing a proper macro system instead.

Likewise the new interceptors infrastructure is a workaround to avoid implementing proper AOP support, like Microsoft Fakes.


> Whether you do Foo.Serialize() and it uses reflection to enumerate the properties, carries around tags permanently or it uses some compiletime generated function has nothing much to do with expressiveness.

Thinking those are the only options is exactly why the issue is expressiveness.


Is this a reference to some specific, better, technique or an optimistic belief that such a thing could be built if only ..?


Code generators are used because run-time introspection tends to be slow(er) and because debugging code generated at runtime is harder and because IDEs don't know how to deal with code generated at runtime. But there no reason why this should be so. No good reason to have a hard boundary between compiletime and runtime either. These are just historical artifacts.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: