Re: Re: What do you think about a C# 6 like nameof() expression for

2019-06-14 Thread Stas Berkov
guest271314, what is you point against `nameof` feature? If you don't like it - don't use it. Why prohibit this feature for those who find it beneficial? I see `nameof` beneficial in following cases Case 1. Function guard. ``` function func1(options) { ... if (options.userName == undefined) {

Re: Re: What do you think about a C# 6 like nameof() expression for

2019-06-14 Thread Stas Berkov
Fri, Jun 14, 2019 at 9:48 PM Stas Berkov wrote: > Less fragile. Less mess. You can rename field/property without fear you > break something (using IDE refactoring tools). > With high probablity you will break something when you refactor and have > fields hardcoded as strings. > Someo

Re: Re: What do you think about a C# 6 like nameof() expression for

2019-06-14 Thread Stas Berkov
You get more robust code. > > How is "robust" objectively determined? > > > > > On Fri, Jun 14, 2019 at 5:21 PM Stas Berkov wrote: > >> ES can befit from `nameof` feature the same way as TS. There is no TS >> specific in it. >> It was ask

Re: Re: What do you think about a C# 6 like nameof() expression for

2019-06-14 Thread Stas Berkov
uages, most of the use cases don't apply to dynamic > Javascript > The only legit use case I can think of is helping refactor tools to > rename properties (but even mismatch errors between strings and > properties names can be caught in compile time using modern > Typescript)

Re: Re: What do you think about a C# 6 like nameof() expression for

2019-06-14 Thread Stas Berkov
Can we revisit this issue? In C# there is `nameof`, in Swift you can do the same by calling ``` let keyPath = \Person.mother.firstName NSPredicate(format: "%K == %@", keyPath, "Andrew") ``` Let's introduce `nameof` in ES, please. Devs from TypeScript don't want to introduce this feature in