On 2020-08-01 18:20, Ian Lance Taylor wrote:
>> I'm wondering. Would it be better to have say a template in a folder that is
>> used to generate all the various typed Golang ready for the compiler.
>>
>> This way the code would be fully typed and could be maintained in one place. 
>> The
>> compiler could maybe still be as fast as today post generation and the 
>> untyped
>> code ignored and the generated typed code read more easily as standard code?
> There are existing tools that work that way for Go.  They can be
> awkward for cases where you need to instantiate a type with a generic
> type, as in List(List(int)).  They don't tend to help much with
> compilation time overall, as each package that needs a generic type
> needs to instantiate the template itself, so you get lots of
> duplicates that all get compiled.  Debugging is awkward as the
> debugger doesn't know anything about the copies.

I was mainly thinking that having duplicate code with typed syntax would be more
understandable and a substantial advantage over new generic syntax that requires
further interpretation by the reader. The generated .go files could also teach
how to write the generic code. Sounds like it may have already been considered
and ruled out though.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4b61560a-686e-9069-a9e7-cf8e206fd127%40gmail.com.

Reply via email to