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

2019-06-19 Thread guest271314
>
> Especially since your point seems to be "I don't understand"


Don't make up stories.


> and "it won't help me personally"


Did not state that either.

It's time to take a step back


Not sure what you mean.

On Thu, Jun 20, 2019 at 1:15 AM Frederick Stark  wrote:

> You've already made this point, so you're not adding anything new to the
> discussion now. Especially since your point seems to be "I don't
> understand" and "it won't help me personally"
> It's time to take a step back and allow others to discuss. If a formal
> proposal eventuates, you can continue to make your points there
>
> On Jun 20 2019, at 11:05 am, guest271314  wrote:
>
> The current proposal is redundant.  The user has to already know and write
> the exact name of the variable, or try to guess the variable name to not,
> or to, catch an error that includes the name of the identifier as a
> string.  Why should the user have to already know any write the variable as
> a literal? If that feature is valuable to users of JavaScript by all means
> write that definition.
>
> Extending the original proposal with the ability for the user to use
> ```nameof``` to get list of all varibales declared using ```const``` and
> ```let``` without having to already know and write the exact variable name,
> that is, when called without an adjacent exact variable identifier, e.g.,
> ```const nameofall = nameof *; // ["y", "x"] which can also include line
> number```, as well, would not be redundant, and would also benefit users of
> JavaScript directly where defining the feature would provide values that
> are not currently possible (without previously knowing and writing the
> exact name of the variable identifier, or guessing the names of the
> identifiers, which should be also already be possible).
>
> On Wed, Jun 19, 2019 at 6:31 PM Isiah Meadows 
> wrote:
>
> I get yet again that the forest here is being missed for the trees.
>
> @guest271314 This isn't specific to any one IDE, and isn't even
> specific to static tools. As mentioned before, this has applicability
> to assertion libraries (like a userland version of Power Assert) as
> well as other things. It's almost exclusively just quality-of-life
> improvements to developers, but it's not specific to IDEs or even
> static tooling.
>
> -
>
> Isiah Meadows
> cont...@isiahmeadows.com
> www.isiahmeadows.com
>
> On Mon, Jun 17, 2019 at 8:28 PM guest271314  wrote:
> >
> >
> > > You have ignored the context from Jordan’s email (emphasis added):
> >
> >
> >
> > >> again, `Object.keys({ y })[0]` will give you the string `y`, and will
> survive refactoring tools. you can even do `function nameof(obj) { return
> Object.keys(obj)[0]; }` and then `nameof({ y })`.
> >
> >
> > No, did not _ignore_ the context of the email.
> >
> >
> > Simply have no reference point for relying on an external tool, that is,
> essentially a text editor, to write and dynamically "refactor" code. Here,
> the code will be tested outside of the text editor in short order once
> composed.
> >
> >
> > Was able to rename text at Mousepad and record the entire process within
> 20 seconds without needing to use ```nameof``` and without encountering any
> issues such as mispelling the variable name or the text editor trying to
> independently determine what the words am typing mean. The text editor is
> just - a text editor.
> >
> >
> > Perhaps other JavaScript users who rely on "refactoring tools" and
> "rename refactoring" in an IDE can relate. Not able to gather the
> significance of ```nameof``` here - as in each case the user has to write
> the name of the variable anyway. To each their own.
> >
> >
> > > VSCode is a popular editor that supports JavaScript *and* is a
> refactoring tool. Rename refactoring was the subject I was responding to.
> >
> >
> >
> >
> >
> > Was not previously aware or did not realize that the _individual choice_
> to use a particular text editor was a substantial reason to ask for change
> to the entire JavaScript language in order for specific users to be able to
> interact with an entirely different language.
> >
> >
> > If VSCode is particularly "popular" why cannot VSCode be specified and
> implemented by and for the users who rely on the text editor to interpret
> what the users' intent is when writing code.
> >
> >
> > In that case  ```mkvmerge``` should be specified as a JavaScript method.
> ```webm``` is a "popular" (cannot help but to recollect "Popularity"
> https://brendaneich.com/2008/04/popularity/) video container that is a
> subset of the Matroska container, where if that method were specified in
> JavaScript a user would be able to do ```mkvmerge({w: true, o:
> "int_all.webm":  i: ["int.webm", "int1.webm", "intN.webm"]})``` instead
> of ```$ mkvmerge -w -o int_all.webm int.webm + int1.webm``` at
> ```terminal```.
> >
> >
> >
> >
> > On Mon, Jun 17, 2019 at 11:29 PM Ron Buckton 
> wrote:
> >>
> >> > How is VSCode related to JavaScript?
> >>
> >>
> >>
> >> You have ignored the 

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

2019-06-19 Thread Frederick Stark
You've already made this point, so you're not adding anything new to the 
discussion now. Especially since your point seems to be "I don't understand" 
and "it won't help me personally"
It's time to take a step back and allow others to discuss. If a formal proposal 
eventuates, you can continue to make your points there

On Jun 20 2019, at 11:05 am, guest271314  wrote:
> The current proposal is redundant. The user has to already know and write the 
> exact name of the variable, or try to guess the variable name to not, or to, 
> catch an error that includes the name of the identifier as a string. Why 
> should the user have to already know any write the variable as a literal? If 
> that feature is valuable to users of JavaScript by all means write that 
> definition.
>
> Extending the original proposal with the ability for the user to use 
> ```nameof``` to get list of all varibales declared using ```const``` and 
> ```let``` without having to already know and write the exact variable name, 
> that is, when called without an adjacent exact variable identifier, e.g., 
> ```const nameofall = nameof *; // ["y", "x"] which can also include line 
> number```, as well, would not be redundant, and would also benefit users of 
> JavaScript directly where defining the feature would provide values that are 
> not currently possible (without previously knowing and writing the exact name 
> of the variable identifier, or guessing the names of the identifiers, which 
> should be also already be possible).
> On Wed, Jun 19, 2019 at 6:31 PM Isiah Meadows  (mailto:isiahmead...@gmail.com)> wrote:
> > I get yet again that the forest here is being missed for the trees.
> >
> > @guest271314 This isn't specific to any one IDE, and isn't even
> > specific to static tools. As mentioned before, this has applicability
> > to assertion libraries (like a userland version of Power Assert) as
> > well as other things. It's almost exclusively just quality-of-life
> > improvements to developers, but it's not specific to IDEs or even
> > static tooling.
> >
> > -
> > Isiah Meadows
> > cont...@isiahmeadows.com (mailto:cont...@isiahmeadows.com)
> > www.isiahmeadows.com (http://www.isiahmeadows.com)
> >
> > On Mon, Jun 17, 2019 at 8:28 PM guest271314  > (mailto:guest271...@gmail.com)> wrote:
> > >
> > >
> > > > You have ignored the context from Jordan’s email (emphasis added):
> > >
> > >
> > >
> > > >> again, `Object.keys({ y })[0]` will give you the string `y`, and will 
> > > >> survive refactoring tools. you can even do `function nameof(obj) { 
> > > >> return Object.keys(obj)[0]; }` and then `nameof({ y })`.
> > >
> > >
> > > No, did not _ignore_ the context of the email.
> > >
> > >
> > > Simply have no reference point for relying on an external tool, that is, 
> > > essentially a text editor, to write and dynamically "refactor" code. 
> > > Here, the code will be tested outside of the text editor in short order 
> > > once composed.
> > >
> > >
> > > Was able to rename text at Mousepad and record the entire process within 
> > > 20 seconds without needing to use ```nameof``` and without encountering 
> > > any issues such as mispelling the variable name or the text editor trying 
> > > to independently determine what the words am typing mean. The text editor 
> > > is just - a text editor.
> > >
> > >
> > > Perhaps other JavaScript users who rely on "refactoring tools" and 
> > > "rename refactoring" in an IDE can relate. Not able to gather the 
> > > significance of ```nameof``` here - as in each case the user has to write 
> > > the name of the variable anyway. To each their own.
> > >
> > >
> > > > VSCode is a popular editor that supports JavaScript *and* is a 
> > > > refactoring tool. Rename refactoring was the subject I was responding 
> > > > to.
> > >
> > >
> > >
> > >
> > >
> > > Was not previously aware or did not realize that the _individual choice_ 
> > > to use a particular text editor was a substantial reason to ask for 
> > > change to the entire JavaScript language in order for specific users to 
> > > be able to interact with an entirely different language.
> > >
> > >
> > > If VSCode is particularly "popular" why cannot VSCode be specified and 
> > > implemented by and for the users who rely on the text editor to interpret 
> > > what the users' intent is when writing code.
> > >
> > >
> > > In that case ```mkvmerge``` should be specified as a JavaScript method. 
> > > ```webm``` is a "popular" (cannot help but to recollect "Popularity" 
> > > https://brendaneich.com/2008/04/popularity/) video container that is a 
> > > subset of the Matroska container, where if that method were specified in 
> > > JavaScript a user would be able to do ```mkvmerge({w: true, o: 
> > > "int_all.webm": i: ["int.webm", "int1.webm", "intN.webm"]})``` 
> > > instead of ```$ mkvmerge -w -o int_all.webm int.webm + int1.webm``` at 
> > > ```terminal```.
> > >
> > >
> > >
> > >
> > > On Mon, Jun 17, 2019 at 11:29 PM Ron Buckton  > > 

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

2019-06-19 Thread guest271314
The current proposal is redundant.  The user has to already know and write
the exact name of the variable, or try to guess the variable name to not,
or to, catch an error that includes the name of the identifier as a
string.  Why should the user have to already know any write the variable as
a literal? If that feature is valuable to users of JavaScript by all means
write that definition.

Extending the original proposal with the ability for the user to use
```nameof``` to get list of all varibales declared using ```const``` and
```let``` without having to already know and write the exact variable name,
that is, when called without an adjacent exact variable identifier, e.g.,
```const nameofall = nameof *; // ["y", "x"] which can also include line
number```, as well, would not be redundant, and would also benefit users of
JavaScript directly where defining the feature would provide values that
are not currently possible (without previously knowing and writing the
exact name of the variable identifier, or guessing the names of the
identifiers, which should be also already be possible).

On Wed, Jun 19, 2019 at 6:31 PM Isiah Meadows 
wrote:

> I get yet again that the forest here is being missed for the trees.
>
> @guest271314 This isn't specific to any one IDE, and isn't even
> specific to static tools. As mentioned before, this has applicability
> to assertion libraries (like a userland version of Power Assert) as
> well as other things. It's almost exclusively just quality-of-life
> improvements to developers, but it's not specific to IDEs or even
> static tooling.
>
> -
>
> Isiah Meadows
> cont...@isiahmeadows.com
> www.isiahmeadows.com
>
> On Mon, Jun 17, 2019 at 8:28 PM guest271314  wrote:
> >
> >
> > > You have ignored the context from Jordan’s email (emphasis added):
> >
> >
> >
> > >> again, `Object.keys({ y })[0]` will give you the string `y`, and will
> survive refactoring tools. you can even do `function nameof(obj) { return
> Object.keys(obj)[0]; }` and then `nameof({ y })`.
> >
> >
> > No, did not _ignore_ the context of the email.
> >
> >
> > Simply have no reference point for relying on an external tool, that is,
> essentially a text editor, to write and dynamically "refactor" code. Here,
> the code will be tested outside of the text editor in short order once
> composed.
> >
> >
> > Was able to rename text at Mousepad and record the entire process within
> 20 seconds without needing to use ```nameof``` and without encountering any
> issues such as mispelling the variable name or the text editor trying to
> independently determine what the words am typing mean. The text editor is
> just - a text editor.
> >
> >
> > Perhaps other JavaScript users who rely on "refactoring tools" and
> "rename refactoring" in an IDE can relate. Not able to gather the
> significance of ```nameof``` here - as in each case the user has to write
> the name of the variable anyway. To each their own.
> >
> >
> > > VSCode is a popular editor that supports JavaScript *and* is a
> refactoring tool. Rename refactoring was the subject I was responding to.
> >
> >
> >
> >
> >
> > Was not previously aware or did not realize that the _individual choice_
> to use a particular text editor was a substantial reason to ask for change
> to the entire JavaScript language in order for specific users to be able to
> interact with an entirely different language.
> >
> >
> > If VSCode is particularly "popular" why cannot VSCode be specified and
> implemented by and for the users who rely on the text editor to interpret
> what the users' intent is when writing code.
> >
> >
> > In that case  ```mkvmerge``` should be specified as a JavaScript method.
> ```webm``` is a "popular" (cannot help but to recollect "Popularity"
> https://brendaneich.com/2008/04/popularity/) video container that is a
> subset of the Matroska container, where if that method were specified in
> JavaScript a user would be able to do ```mkvmerge({w: true, o:
> "int_all.webm":  i: ["int.webm", "int1.webm", "intN.webm"]})``` instead
> of ```$ mkvmerge -w -o int_all.webm int.webm + int1.webm``` at
> ```terminal```.
> >
> >
> >
> >
> > On Mon, Jun 17, 2019 at 11:29 PM Ron Buckton 
> wrote:
> >>
> >> > How is VSCode related to JavaScript?
> >>
> >>
> >>
> >> You have ignored the context from Jordan’s email (emphasis added):
> >>
> >>
> >>
> >> >> again, `Object.keys({ y })[0]` will give you the string `y`, and
> will survive refactoring tools. you can even do `function nameof(obj) {
> return Object.keys(obj)[0]; }` and then `nameof({ y })`.
> >>
> >>
> >>
> >> VSCode is a popular editor that supports JavaScript *and* is a
> refactoring tool. Rename refactoring was the subject I was responding to.
> >>
> >>
> >>
> >> There are a number of reasons VSCode has implemented rename refactoring
> in this fashion. Not the least of which is that an editor cannot fully
> understand user intent. Let us say, for example, you are working with Gulp:
> >>
> >>
> >>
> >> ```
> >>
> 

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

2019-06-19 Thread Isiah Meadows
I get yet again that the forest here is being missed for the trees.

@guest271314 This isn't specific to any one IDE, and isn't even
specific to static tools. As mentioned before, this has applicability
to assertion libraries (like a userland version of Power Assert) as
well as other things. It's almost exclusively just quality-of-life
improvements to developers, but it's not specific to IDEs or even
static tooling.

-

Isiah Meadows
cont...@isiahmeadows.com
www.isiahmeadows.com

On Mon, Jun 17, 2019 at 8:28 PM guest271314  wrote:
>
>
> > You have ignored the context from Jordan’s email (emphasis added):
>
>
>
> >> again, `Object.keys({ y })[0]` will give you the string `y`, and will 
> >> survive refactoring tools. you can even do `function nameof(obj) { return 
> >> Object.keys(obj)[0]; }` and then `nameof({ y })`.
>
>
> No, did not _ignore_ the context of the email.
>
>
> Simply have no reference point for relying on an external tool, that is, 
> essentially a text editor, to write and dynamically "refactor" code. Here, 
> the code will be tested outside of the text editor in short order once 
> composed.
>
>
> Was able to rename text at Mousepad and record the entire process within 20 
> seconds without needing to use ```nameof``` and without encountering any 
> issues such as mispelling the variable name or the text editor trying to 
> independently determine what the words am typing mean. The text editor is 
> just - a text editor.
>
>
> Perhaps other JavaScript users who rely on "refactoring tools" and "rename 
> refactoring" in an IDE can relate. Not able to gather the significance of 
> ```nameof``` here - as in each case the user has to write the name of the 
> variable anyway. To each their own.
>
>
> > VSCode is a popular editor that supports JavaScript *and* is a refactoring 
> > tool. Rename refactoring was the subject I was responding to.
>
>
>
>
>
> Was not previously aware or did not realize that the _individual choice_ to 
> use a particular text editor was a substantial reason to ask for change to 
> the entire JavaScript language in order for specific users to be able to 
> interact with an entirely different language.
>
>
> If VSCode is particularly "popular" why cannot VSCode be specified and 
> implemented by and for the users who rely on the text editor to interpret 
> what the users' intent is when writing code.
>
>
> In that case  ```mkvmerge``` should be specified as a JavaScript method. 
> ```webm``` is a "popular" (cannot help but to recollect "Popularity" 
> https://brendaneich.com/2008/04/popularity/) video container that is a subset 
> of the Matroska container, where if that method were specified in JavaScript 
> a user would be able to do ```mkvmerge({w: true, o: "int_all.webm":  i: 
> ["int.webm", "int1.webm", "intN.webm"]})``` instead of ```$ mkvmerge -w 
> -o int_all.webm int.webm + int1.webm``` at ```terminal```.
>
>
>
>
> On Mon, Jun 17, 2019 at 11:29 PM Ron Buckton  
> wrote:
>>
>> > How is VSCode related to JavaScript?
>>
>>
>>
>> You have ignored the context from Jordan’s email (emphasis added):
>>
>>
>>
>> >> again, `Object.keys({ y })[0]` will give you the string `y`, and will 
>> >> survive refactoring tools. you can even do `function nameof(obj) { return 
>> >> Object.keys(obj)[0]; }` and then `nameof({ y })`.
>>
>>
>>
>> VSCode is a popular editor that supports JavaScript *and* is a refactoring 
>> tool. Rename refactoring was the subject I was responding to.
>>
>>
>>
>> There are a number of reasons VSCode has implemented rename refactoring in 
>> this fashion. Not the least of which is that an editor cannot fully 
>> understand user intent. Let us say, for example, you are working with Gulp:
>>
>>
>>
>> ```
>>
>> const cwd /*1*/ = ".";
>>
>> gulp.src("*.js", { cwd /*2*/ });
>>
>> ```
>>
>>
>>
>> If you were to rename `cwd` at (1) and it *also* renamed the `cwd` property 
>> at (2), you would have introduced an error in the call because a `cwd` 
>> option to gulp has a special meaning. Since the editor doesn’t know the 
>> intent of the user may be to rename *both* symbols, it remains conservative 
>> and choses only to rename the binding and its references, producing:
>>
>>
>>
>> ```
>>
>> const currentDir = ".";
>>
>> gulp.src("*.js", { cwd: currentDir });
>>
>> ```
>>
>>
>>
>> There is also the issue of collisions:
>>
>>
>>
>> ```
>>
>> const foo /*1*/ = 1;
>>
>> f({ foo /*2*/, bar: 2 });
>>
>> ```
>>
>>
>>
>> If I were to use a refactoring tool to rename `foo` at (1) to `bar`, it 
>> would *not* be safe to rename the property at (2) as well as it would 
>> introduce a semantic error that would prevent the entire script from 
>> executing.
>>
>>
>>
>> In the context of Jordan’s email, that means that `Object.keys({ y })[0]` 
>> would *not* necessarily survive refactoring tools.
>>
>>
>>
>> From: es-discuss  On Behalf Of guest271314
>> Sent: Monday, June 17, 2019 7:40 AM
>> Cc: es-discuss@mozilla.org
>> Subject: Re: Re: What do you think about a C# 

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

2019-06-19 Thread Isiah Meadows
Because the declaration itself is hoisted. The TDZ only delays
*initialization*, not *declaration*.

- For `var`, the declaration is hoisted *and* it's automatically
initialized to `undefined` before executing any body code.
- For `function foo() { ... }`, the declaration is hoisted *and* the
value is automatically initialized to a new function object
encapsulating the function's body before executing any body code.
- For all other types, the declaration is hoisted, but it is *not*
possible to initialize it yet. It's initialized to `undefined` for
`let value;` when that statement is executed, the relevant function
object for `class Foo`, the RHS value for `let value = expr`/`const
value = expr`, and so on. (Most of the complexity is in destructured
bindings and default parameters, but it's not black magic, I promise.)
- Keep in mind it's possible to get a reference to an uninitialized
variable, even though it's not possible to access any value yet.

This mechanism already exists today, and `nameof` would just leverage
that mechanism. The static value would be computed *after* the
variable would have been linked (either at the global scope or after
the declaration exists), and only after falling back to the global
scope would the value fall back to a dynamic lookup and test.

-

Isiah Meadows
cont...@isiahmeadows.com
www.isiahmeadows.com

On Sun, Jun 16, 2019 at 8:15 PM guest271314  wrote:
>
> > - If `y` is directly visible in scope and is neither a parameter or
> destructured binding, `nameof y` should just evaluate to `"y"`. This
> should be agnostic to whether the binding has been declared yet, so in
> your example, `x` should be set to `"y"`.
>
> The 1st question at 
> https://esdiscuss.org/topic/what-do-you-think-about-a-c-6-like-nameof-expression-for#content-33
>  remains:
>
> Without having composed or previously read the source code, at line 1 
> adjacent to ```nameof``` how does the user know that there will be later 
> declared variable named ```y```?
>
>
>
> On Sun, Jun 16, 2019 at 7:04 AM Isiah Meadows  wrote:
>>
>> Here's my opinion:
>>
>> - If `y` is directly visible in scope and is neither a parameter or
>> destructured binding, `nameof y` should just evaluate to `"y"`. This
>> should be agnostic to whether the binding has been declared yet, so in
>> your example, `x` should be set to `"y"`.
>> - If `y` is entirely undeclared, it should be a runtime
>> `ReferenceError` in the same way it is when accessing undefined
>> globals. So in your second example, I'd expect it to throw before even
>> attempting assignment
>>
>> -
>>
>> Isiah Meadows
>> cont...@isiahmeadows.com
>> www.isiahmeadows.com
>>
>> On Sun, Jun 16, 2019 at 12:00 AM guest271314  wrote:
>> >
>> > ```
>> > const x = nameof y
>> > const y = 1;
>> > ```
>> >
>> > At line 1 adjacent to ```nameof``` how does the user even know that there 
>> > is a variable that will be declared named ```y```?
>> >
>> > What is the output of ```x``` where there is no variable named ```y``` 
>> > later declared?
>> >
>> > ```
>> > const x = nameof y
>> > const z = 1;
>> > ```
>> >
>> > On Sun, Jun 16, 2019 at 12:03 AM Ron Buckton  
>> > wrote:
>> >>
>> >> > What should occur where the code is
>> >>
>> >> It would be "y" in all 3 places.
>> >>
>> >> > ... is a proposal for _more_ than only getting the _name_ of an 
>> >> > _declared_ and _initialized_ variable?
>> >>
>> >> It is a proposal for getting the name of a _declared_ variable. Whether 
>> >> it is _initialized_ does not matter.
>> >>
>> >> > Should a ```RefefenceError``` _not_ be thrown simple because 
>> >> > ```nameof``` is used?
>> >>
>> >> No, an error is not thrown. ECMAScript is much more nuanced. Block scoped 
>> >> variables from 'let' or 'const' exist and can be *referenced* (via 
>> >> closure or export, currently) anywhere within the same block scope, even 
>> >> before they are initialized. Until they have been *initialized* (the line 
>> >> of code contain the declaration has been reached and evaluated), they 
>> >> exist in a "Temporal Dead Zone" (TDZ). Attempting to *dereference* them 
>> >> (i.e. access or store a value) while in this TDZ is what results in the 
>> >> ReferenceError.
>> >>
>> >> At no point does the `nameof` operator *dereference* the variable, so no 
>> >> error need be thrown.
>> >>
>> >> From: guest271314
>> >> Sent: Saturday, June 15, 4:29 PM
>> >> Subject: Re: Re: What do you think about a C# 6 like nameof() expression 
>> >> for
>> >> To: Ron Buckton
>> >> Cc: es-discuss@mozilla.org
>> >>
>> >>
>> >>
>> >>
>> >> What should occur where the code is
>> >>
>> >> ```
>> >> const x = nameof y
>> >> await new Promise(resolve => setTimeout(resolve, 10)); // should x be 
>> >> "y" here?
>> >> await new Promise(resolve => setTimeout(resolve, 20)); // should x be 
>> >> "y" here?
>> >> await Promise.all([new Promise(resolve => setTimeout(resolve, 30)), 
>> >> ...doStuff()]); // should x be "y" here?
>> >> const y = 1;
>> >> ```
>> >>
>> >> ?
>>