On Friday, September 7, 2018 at 3:01:23 AM UTC-5, Nigel Tao wrote:
>
> Building on Todd's example, you can add a little more type safety
> (having the map value type be a "func etc" instead of "reflect.Value)
> by Curry'ing the receiver: https://play.golang.org/p/n3sDpxfd2td
>
> I've also spli
Ha, I wrote this version before I saw that response:
https://play.golang.org/p/vO2TI7OeJk_E
On 7 September 2018 at 09:00, Nigel Tao wrote:
> Building on Todd's example, you can add a little more type safety
> (having the map value type be a "func etc" instead of "reflect.Value)
> by Curry'ing th
Building on Todd's example, you can add a little more type safety
(having the map value type be a "func etc" instead of "reflect.Value)
by Curry'ing the receiver: https://play.golang.org/p/n3sDpxfd2td
I've also split up the single run function into two: one binds strings
to functions, the second t
On Fri, Sep 7, 2018 at 1:53 PM Eric Raymond wrote:
> ...provided, that is, that it's possible to get from the member name to a
> function pointer that can be called like a closure. Does the reflection
> system support such a call-indirect method?
Yep. No embedding or other inheritance-like fea
Eric Raymond writes:
> Obviously we can't use inheritance in the normal sense here, but I was
> hoping that if an embedded instance of Cmd could discover the struct
> instance it's part of, a similar thing could be pulled off. Alas, your
> answer that this can't be done is unsurprising and
On Thursday, September 6, 2018 at 9:45:37 PM UTC-4, Nigel Tao wrote:
>
> Asking about embedding and reflection sounds like an XY problem
> (http://xyproblem.info/). Can you elaborate on what "walk through the
> user-defined methods of a Cmd-like interpreter instance" is?
>
Sure. My reposurge
On Fri, Sep 7, 2018 at 9:34 AM Eric Raymond wrote:
> The attached program lists
For future reference, it would probably be easier for the mailing list
to discuss example code via a link to the Go playground, especially
for runnable code. In this case: https://play.golang.org/p/IripNZNYIgo
> In
This question is intended to assist implementation of a Go workalike for
the Python Cmd library. This workalike will be made publicly available,
The attached program lists
Inner
id
as expected - that is, the fieldnames of the Outer structure. But
ListFields is a method of Inner.
In the attac