On Fri, Oct 19, 2018 at 1:03 PM, Eric S. Raymond <e...@thyrsus.com> wrote:
> Burak Serdar <bser...@ieee.org>:
>> One other difference between the two is the ability of the "like"
>> syntax to use a struct as well as an interface for templates, so you
>> can require concrete implementations to have certain fields, instead
>> of getter/setters.
>
> I'm puzzled that this is not already possible in interfaces.
>
> In the translation from Python I'm working on, I cave two different
> classes, One, VCS, represents an importer/exporter pair for a given
> version-control system that speaks the git import stram
> format. Another, Extractor, bundles methods for mining data from a
> repository by harnessing its native client tools.
>
> Both classes want to be selected by a field "name". It's annoying that
> I can't declare an interface that says "has a field 'name'" and instead
> have to declare a getter function with no other point besides sliding
> around that restriction.
>
> But precisely because this could easily be patched into interfaces,
> I think it's not much of an argument for your plan.

I think you are talking about https://golang.org/issue/23796 (which
was not accepted).

Ian

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to