__line_number__ and __filename__

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

__line_number__ and __filename__

Aaron Gray-4
I wondering what people think about the idea of proposing being able to get the line number and filename of executing code in the code ? Maybe with something simular to C preprocessors __line_number__ and __filename__. Or as subobjects of global ?

--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

Peter Jaszkowiak

On Thu, Aug 23, 2018, 16:57 Aaron Gray <[hidden email]> wrote:
I wondering what people think about the idea of proposing being able to get the line number and filename of executing code in the code ? Maybe with something simular to C preprocessors __line_number__ and __filename__. Or as subobjects of global ?

--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

Gus Caplan
In reply to this post by Aaron Gray-4
What is the reasoning behind wanting this data? For example, in exceptional cases you should be creating errors which already have stacks containing this information.

-Gus

---- On Thu, 23 Aug 2018 17:56:43 -0500 Aaron Gray <[hidden email]> wrote ----

I wondering what people think about the idea of proposing being able to get the line number and filename of executing code in the code ? Maybe with something simular to C preprocessors __line_number__ and __filename__. Or as subobjects of global ?

--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
_______________________________________________
es-discuss mailing list



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

Aaron Gray-4
I am debugging existing code that I have modularized, and am class'izing that has unittests and it just would have been very useful to have this facility.

On Fri, 24 Aug 2018 at 00:27, Gus Caplan <[hidden email]> wrote:
What is the reasoning behind wanting this data? For example, in exceptional cases you should be creating errors which already have stacks containing this information.

-Gus

---- On Thu, 23 Aug 2018 17:56:43 -0500 Aaron Gray <[hidden email]> wrote ----

I wondering what people think about the idea of proposing being able to get the line number and filename of executing code in the code ? Maybe with something simular to C preprocessors __line_number__ and __filename__. Or as subobjects of global ?

--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
_______________________________________________
es-discuss mailing list




--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

J Decker
On Thu, Aug 23, 2018 at 5:26 PM Aaron Gray <[hidden email]> wrote:
I am debugging existing code that I have modularized, and am class'izing that has unittests and it just would have been very useful to have this facility.
In a  browser, console.log is usually associated with the file and line number anyway; which includes using devtools with node.... but it would be handy for logging.  with V8 there is console.trace; which spits out the stack trace too... before I discovered that I did a logging function like... 

function stackTrace() { var err = new Error(); return err.stack; }  // parse stack to get frame-1 online

// or maybe just frame-1...
function stackTrace() { var err = new Error(); return err.stack.split( "\n" )[1]; }  

---
function stacktrace() {
  function st2(f) {
    return !f ? [] :
        st2(f.caller).concat([f.toString().split('(')[0].substring(9) + '(' + f.arguments.join(',') + ')']);
  }
  return st2(arguments.callee.caller);
}

 EDIT 2 (2017) :

In all modern browsers you can simply call: console.trace(); (MDN Reference)
---

Although I do still miss just being able to get __FILE__ and __LINE__ 


On Fri, 24 Aug 2018 at 00:27, Gus Caplan <[hidden email]> wrote:
What is the reasoning behind wanting this data? For example, in exceptional cases you should be creating errors which already have stacks containing this information.

-Gus

---- On Thu, 23 Aug 2018 17:56:43 -0500 Aaron Gray <[hidden email]> wrote ----

I wondering what people think about the idea of proposing being able to get the line number and filename of executing code in the code ? Maybe with something simular to C preprocessors __line_number__ and __filename__. Or as subobjects of global ?

--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
_______________________________________________
es-discuss mailing list




--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

Aaron Gray-4
On Fri, 24 Aug 2018 at 04:56, J Decker <[hidden email]> wrote:
On Thu, Aug 23, 2018 at 5:26 PM Aaron Gray <[hidden email]> wrote:
I am debugging existing code that I have modularized, and am class'izing that has unittests and it just would have been very useful to have this facility.
In a  browser, console.log is usually associated with the file and line number anyway; which includes using devtools with node.... but it would be handy for logging.  with V8 there is console.trace; which spits out the stack trace too... before I discovered that I did a logging function like... 

function stackTrace() { var err = new Error(); return err.stack; }  // parse stack to get frame-1 online

// or maybe just frame-1...
function stackTrace() { var err = new Error(); return err.stack.split( "\n" )[1]; }  

---
function stacktrace() {
  function st2(f) {
    return !f ? [] :
        st2(f.caller).concat([f.toString().split('(')[0].substring(9) + '(' + f.arguments.join(',') + ')']);
  }
  return st2(arguments.callee.caller);
}

 EDIT 2 (2017) :

In all modern browsers you can simply call: console.trace(); (MDN Reference)

Yes slightly long winded to say the least :)
 
---

Although I do still miss just being able to get __FILE__ and __LINE__ 

Yeah it should be easy to have such stuff compiled by JIT 

Aaron
-Gus

---- On Thu, 23 Aug 2018 17:56:43 -0500 Aaron Gray <[hidden email]> wrote ----

I wondering what people think about the idea of proposing being able to get the line number and filename of executing code in the code ? Maybe with something simular to C preprocessors __line_number__ and __filename__. Or as subobjects of global ?

--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
_______________________________________________
es-discuss mailing list




--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

Peter Jaszkowiak
Did nobody see my email? There is already a mechanism in the works for exposing this kind of metadata: 



On Fri, Aug 24, 2018, 07:56 Aaron Gray <[hidden email]> wrote:
On Fri, 24 Aug 2018 at 04:56, J Decker <[hidden email]> wrote:
On Thu, Aug 23, 2018 at 5:26 PM Aaron Gray <[hidden email]> wrote:
I am debugging existing code that I have modularized, and am class'izing that has unittests and it just would have been very useful to have this facility.
In a  browser, console.log is usually associated with the file and line number anyway; which includes using devtools with node.... but it would be handy for logging.  with V8 there is console.trace; which spits out the stack trace too... before I discovered that I did a logging function like... 

function stackTrace() { var err = new Error(); return err.stack; }  // parse stack to get frame-1 online

// or maybe just frame-1...
function stackTrace() { var err = new Error(); return err.stack.split( "\n" )[1]; }  

---
function stacktrace() {
  function st2(f) {
    return !f ? [] :
        st2(f.caller).concat([f.toString().split('(')[0].substring(9) + '(' + f.arguments.join(',') + ')']);
  }
  return st2(arguments.callee.caller);
}

 EDIT 2 (2017) :

In all modern browsers you can simply call: console.trace(); (MDN Reference)

Yes slightly long winded to say the least :)
 
---

Although I do still miss just being able to get __FILE__ and __LINE__ 

Yeah it should be easy to have such stuff compiled by JIT 

Aaron
-Gus

---- On Thu, 23 Aug 2018 17:56:43 -0500 Aaron Gray <[hidden email]> wrote ----

I wondering what people think about the idea of proposing being able to get the line number and filename of executing code in the code ? Maybe with something simular to C preprocessors __line_number__ and __filename__. Or as subobjects of global ?

--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
_______________________________________________
es-discuss mailing list




--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

Aaron Gray-4
On Fri, 24 Aug 2018 at 16:34, Peter Jaszkowiak <[hidden email]> wrote:
Did nobody see my email? There is already a mechanism in the works for exposing this kind of metadata: 



Thanks, thats probably okay for the filename but for line number information that does not realy look too applicable and ideally both have a simular mechanism. 

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

Claude Pache
In reply to this post by J Decker


Le 24 août 2018 à 05:55, J Decker <[hidden email]> a écrit :

On Thu, Aug 23, 2018 at 5:26 PM Aaron Gray <[hidden email]> wrote:
I am debugging existing code that I have modularized, and am class'izing that has unittests and it just would have been very useful to have this facility.
In a  browser, console.log is usually associated with the file and line number anyway; which includes using devtools with node.... but it would be handy for logging.  with V8 there is console.trace; which spits out the stack trace too... before I discovered that I did a logging function like... 

function stackTrace() { var err = new Error(); return err.stack; }  // parse stack to get frame-1 online

// or maybe just frame-1...
function stackTrace() { var err = new Error(); return err.stack.split( "\n" )[1]; }  

---
function stacktrace() {
  function st2(f) {
    return !f ? [] :
        st2(f.caller).concat([f.toString().split('(')[0].substring(9) + '(' + f.arguments.join(',') + ')']);
  }
  return st2(arguments.callee.caller);
}

 EDIT 2 (2017) :

In all modern browsers you can simply call: console.trace(); (MDN Reference)
---

Although I do still miss just being able to get __FILE__ and __LINE__ 


See also:


If/when that proposal is implemented, you'll have a simple way to get a *structured* representation of the trace:

```js
System.getTrace(new Error)
```

from which you can much more easily extract line number, filename, etc.

—Claude


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

Bob Myers
What does line number, or filename for that matter, mean when a file has gone through one or more transpilation and/or minification passes?
Is the notion that the first processor that touches the file would substitute those values?

Bob


On Fri, Aug 24, 2018 at 11:34 PM Claude Pache <[hidden email]> wrote:


Le 24 août 2018 à 05:55, J Decker <[hidden email]> a écrit :

On Thu, Aug 23, 2018 at 5:26 PM Aaron Gray <[hidden email]> wrote:
I am debugging existing code that I have modularized, and am class'izing that has unittests and it just would have been very useful to have this facility.
In a  browser, console.log is usually associated with the file and line number anyway; which includes using devtools with node.... but it would be handy for logging.  with V8 there is console.trace; which spits out the stack trace too... before I discovered that I did a logging function like... 

function stackTrace() { var err = new Error(); return err.stack; }  // parse stack to get frame-1 online

// or maybe just frame-1...
function stackTrace() { var err = new Error(); return err.stack.split( "\n" )[1]; }  

---
function stacktrace() {
  function st2(f) {
    return !f ? [] :
        st2(f.caller).concat([f.toString().split('(')[0].substring(9) + '(' + f.arguments.join(',') + ')']);
  }
  return st2(arguments.callee.caller);
}

 EDIT 2 (2017) :

In all modern browsers you can simply call: console.trace(); (MDN Reference)
---

Although I do still miss just being able to get __FILE__ and __LINE__ 


See also:


If/when that proposal is implemented, you'll have a simple way to get a *structured* representation of the trace:

```js
System.getTrace(new Error)
```

from which you can much more easily extract line number, filename, etc.

—Claude

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

Aaron Gray-4
Ideally at some point we won't be using transpilers anymore ;)


On Fri, 24 Aug 2018 at 19:37, Bob Myers <[hidden email]> wrote:
What does line number, or filename for that matter, mean when a file has gone through one or more transpilation and/or minification passes?
Is the notion that the first processor that touches the file would substitute those values?

Bob


On Fri, Aug 24, 2018 at 11:34 PM Claude Pache <[hidden email]> wrote:


Le 24 août 2018 à 05:55, J Decker <[hidden email]> a écrit :

On Thu, Aug 23, 2018 at 5:26 PM Aaron Gray <[hidden email]> wrote:
I am debugging existing code that I have modularized, and am class'izing that has unittests and it just would have been very useful to have this facility.
In a  browser, console.log is usually associated with the file and line number anyway; which includes using devtools with node.... but it would be handy for logging.  with V8 there is console.trace; which spits out the stack trace too... before I discovered that I did a logging function like... 

function stackTrace() { var err = new Error(); return err.stack; }  // parse stack to get frame-1 online

// or maybe just frame-1...
function stackTrace() { var err = new Error(); return err.stack.split( "\n" )[1]; }  

---
function stacktrace() {
  function st2(f) {
    return !f ? [] :
        st2(f.caller).concat([f.toString().split('(')[0].substring(9) + '(' + f.arguments.join(',') + ')']);
  }
  return st2(arguments.callee.caller);
}

 EDIT 2 (2017) :

In all modern browsers you can simply call: console.trace(); (MDN Reference)
---

Although I do still miss just being able to get __FILE__ and __LINE__ 


See also:


If/when that proposal is implemented, you'll have a simple way to get a *structured* representation of the trace:

```js
System.getTrace(new Error)
```

from which you can much more easily extract line number, filename, etc.

—Claude
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

Ranando King
Realistically, the engine would give back file name and line number (and hopefully character offset) of the code from the fully translated, fully minified, actual logic that the engine loaded. Source maps could be used to convert that obscure value back into actual original source code locations. It would also be nice if there were a way to perform a lookup at runtime, a function that takes a function and returns the internal Location object for that function.

On Fri, Aug 24, 2018 at 3:16 PM Aaron Gray <[hidden email]> wrote:
Ideally at some point we won't be using transpilers anymore ;)


On Fri, 24 Aug 2018 at 19:37, Bob Myers <[hidden email]> wrote:
What does line number, or filename for that matter, mean when a file has gone through one or more transpilation and/or minification passes?
Is the notion that the first processor that touches the file would substitute those values?

Bob


On Fri, Aug 24, 2018 at 11:34 PM Claude Pache <[hidden email]> wrote:


Le 24 août 2018 à 05:55, J Decker <[hidden email]> a écrit :

On Thu, Aug 23, 2018 at 5:26 PM Aaron Gray <[hidden email]> wrote:
I am debugging existing code that I have modularized, and am class'izing that has unittests and it just would have been very useful to have this facility.
In a  browser, console.log is usually associated with the file and line number anyway; which includes using devtools with node.... but it would be handy for logging.  with V8 there is console.trace; which spits out the stack trace too... before I discovered that I did a logging function like... 

function stackTrace() { var err = new Error(); return err.stack; }  // parse stack to get frame-1 online

// or maybe just frame-1...
function stackTrace() { var err = new Error(); return err.stack.split( "\n" )[1]; }  

---
function stacktrace() {
  function st2(f) {
    return !f ? [] :
        st2(f.caller).concat([f.toString().split('(')[0].substring(9) + '(' + f.arguments.join(',') + ')']);
  }
  return st2(arguments.callee.caller);
}

 EDIT 2 (2017) :

In all modern browsers you can simply call: console.trace(); (MDN Reference)
---

Although I do still miss just being able to get __FILE__ and __LINE__ 


See also:


If/when that proposal is implemented, you'll have a simple way to get a *structured* representation of the trace:

```js
System.getTrace(new Error)
```

from which you can much more easily extract line number, filename, etc.

—Claude
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

Aaron Gray-4
Its not rocket science :)

On Fri, 24 Aug 2018 at 21:59, Ranando King <[hidden email]> wrote:
Realistically, the engine would give back file name and line number (and hopefully character offset) of the code from the fully translated, fully minified, actual logic that the engine loaded. Source maps could be used to convert that obscure value back into actual original source code locations. It would also be nice if there were a way to perform a lookup at runtime, a function that takes a function and returns the internal Location object for that function.

On Fri, Aug 24, 2018 at 3:16 PM Aaron Gray <[hidden email]> wrote:
Ideally at some point we won't be using transpilers anymore ;)


On Fri, 24 Aug 2018 at 19:37, Bob Myers <[hidden email]> wrote:
What does line number, or filename for that matter, mean when a file has gone through one or more transpilation and/or minification passes?
Is the notion that the first processor that touches the file would substitute those values?

Bob


On Fri, Aug 24, 2018 at 11:34 PM Claude Pache <[hidden email]> wrote:


Le 24 août 2018 à 05:55, J Decker <[hidden email]> a écrit :

On Thu, Aug 23, 2018 at 5:26 PM Aaron Gray <[hidden email]> wrote:
I am debugging existing code that I have modularized, and am class'izing that has unittests and it just would have been very useful to have this facility.
In a  browser, console.log is usually associated with the file and line number anyway; which includes using devtools with node.... but it would be handy for logging.  with V8 there is console.trace; which spits out the stack trace too... before I discovered that I did a logging function like... 

function stackTrace() { var err = new Error(); return err.stack; }  // parse stack to get frame-1 online

// or maybe just frame-1...
function stackTrace() { var err = new Error(); return err.stack.split( "\n" )[1]; }  

---
function stacktrace() {
  function st2(f) {
    return !f ? [] :
        st2(f.caller).concat([f.toString().split('(')[0].substring(9) + '(' + f.arguments.join(',') + ')']);
  }
  return st2(arguments.callee.caller);
}

 EDIT 2 (2017) :

In all modern browsers you can simply call: console.trace(); (MDN Reference)
---

Although I do still miss just being able to get __FILE__ and __LINE__ 


See also:


If/when that proposal is implemented, you'll have a simple way to get a *structured* representation of the trace:

```js
System.getTrace(new Error)
```

from which you can much more easily extract line number, filename, etc.

—Claude
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: __line_number__ and __filename__

Isiah Meadows-2
In reply to this post by Ranando King
I'm not a fan of adding these to the language when stacks are almost
assuredly coming (time appears to be the limiting factor), and those
would address most things.

Apart from that, the binary AST proposal handles most things like line
mapping support (as a right-after-MVP thing), and it'd function much
like how Java bytecode supports location data inline as well.

https://github.com/binast/ecmascript-binary-ast

-----

Isiah Meadows
[hidden email]
www.isiahmeadows.com

On Fri, Aug 24, 2018 at 1:59 PM Ranando King <[hidden email]> wrote:

>
> Realistically, the engine would give back file name and line number (and hopefully character offset) of the code from the fully translated, fully minified, actual logic that the engine loaded. Source maps could be used to convert that obscure value back into actual original source code locations. It would also be nice if there were a way to perform a lookup at runtime, a function that takes a function and returns the internal Location object for that function.
>
> On Fri, Aug 24, 2018 at 3:16 PM Aaron Gray <[hidden email]> wrote:
>>
>> Ideally at some point we won't be using transpilers anymore ;)
>>
>>
>> On Fri, 24 Aug 2018 at 19:37, Bob Myers <[hidden email]> wrote:
>>>
>>> What does line number, or filename for that matter, mean when a file has gone through one or more transpilation and/or minification passes?
>>> Is the notion that the first processor that touches the file would substitute those values?
>>>
>>> Bob
>>>
>>>
>>> On Fri, Aug 24, 2018 at 11:34 PM Claude Pache <[hidden email]> wrote:
>>>>
>>>>
>>>>
>>>> Le 24 août 2018 à 05:55, J Decker <[hidden email]> a écrit :
>>>>
>>>> On Thu, Aug 23, 2018 at 5:26 PM Aaron Gray <[hidden email]> wrote:
>>>>>
>>>>> I am debugging existing code that I have modularized, and am class'izing that has unittests and it just would have been very useful to have this facility.
>>>>
>>>> In a  browser, console.log is usually associated with the file and line number anyway; which includes using devtools with node.... but it would be handy for logging.  with V8 there is console.trace; which spits out the stack trace too... before I discovered that I did a logging function like...
>>>>
>>>> (from  https://stackoverflow.com/questions/591857/how-can-i-get-a-javascript-stack-trace-when-i-throw-an-exception )
>>>> function stackTrace() { var err = new Error(); return err.stack; }  // parse stack to get frame-1 online
>>>>
>>>> // or maybe just frame-1...
>>>> function stackTrace() { var err = new Error(); return err.stack.split( "\n" )[1]; }
>>>>
>>>> ---
>>>> function stacktrace() {
>>>>   function st2(f) {
>>>>     return !f ? [] :
>>>>         st2(f.caller).concat([f.toString().split('(')[0].substring(9) + '(' + f.arguments.join(',') + ')']);
>>>>   }
>>>>   return st2(arguments.callee.caller);
>>>> }
>>>>
>>>>  EDIT 2 (2017) :
>>>>
>>>> In all modern browsers you can simply call: console.trace(); (MDN Reference)
>>>> ---
>>>>
>>>> Although I do still miss just being able to get __FILE__ and __LINE__
>>>>
>>>>
>>>>
>>>> See also:
>>>>
>>>> https://github.com/tc39/proposal-error-stacks
>>>>
>>>> If/when that proposal is implemented, you'll have a simple way to get a *structured* representation of the trace:
>>>>
>>>> ```js
>>>> System.getTrace(new Error)
>>>> ```
>>>>
>>>> from which you can much more easily extract line number, filename, etc.
>>>>
>>>> —Claude
>>>
>>> _______________________________________________
>>> es-discuss mailing list
>>> [hidden email]
>>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>>
>> --
>> Aaron Gray
>>
>> Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.
>> _______________________________________________
>> es-discuss mailing list
>> [hidden email]
>> https://mail.mozilla.org/listinfo/es-discuss
>
> _______________________________________________
> es-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss