Re: [go-nuts] C# nameof equivalent

2019-03-19 Thread Ian Lance Taylor
On Tue, Mar 19, 2019 at 6:18 AM saurabh singh wrote: > > Yes. I am looking for a compile time operator. > Does the community think it makes sense to start a new formal proposal? Sorry for misunderstanding that this is a purely compile time operation. I don't personally see why this is worth a

Re: [go-nuts] C# nameof equivalent

2019-03-19 Thread saurabh singh
Yes. I am looking for a compile time operator. Does the community think it makes sense to start a new formal proposal? On Tue, Mar 19, 2019, 6:33 PM Robert Engels wrote: > I think nameof is a compile time operation (constant generation) not > runtime. > > I’ve never used it but the ops reques

Re: [go-nuts] C# nameof equivalent

2019-03-19 Thread Robert Engels
I think nameof is a compile time operation (constant generation) not runtime. I’ve never used it but the ops request seems reasonable. Go 2.0 proposal I guess. > On Mar 19, 2019, at 7:53 AM, Ian Lance Taylor wrote: > >> On Tue, Mar 19, 2019 at 5:19 AM saurabh singh wrote: >> >> Is there a

Re: [go-nuts] C# nameof equivalent

2019-03-19 Thread Carlos Alberto Costa Beppler
C# nameof operator is evaluated at compile time. Go does not have this operator, but it would be an nice addition. On Tuesday, March 19, 2019 at 9:53:45 AM UTC-3, Ian Lance Taylor wrote: > > On Tue, Mar 19, 2019 at 5:19 AM saurabh singh > wrote: > > > > Is there an alternative for nameof in go

Re: [go-nuts] C# nameof equivalent

2019-03-19 Thread Ian Lance Taylor
On Tue, Mar 19, 2019 at 5:19 AM saurabh singh wrote: > > Is there an alternative for nameof in golang. > I don't want reflection magic. > Use case is to avoid log messages, validation etc to go out of sync with code > changes: > > func foo(correctParamName string) (interface{}, error){ > if

[go-nuts] C# nameof equivalent

2019-03-19 Thread saurabh singh
Is there an alternative for nameof in golang. I don't want reflection magic. Use case is to avoid log messages, validation etc to go out of sync with code changes: func foo(correctParamName string) (interface{}, er