-
-
Notifications
You must be signed in to change notification settings - Fork 672
Add ArrayBuffer/DataView/Symbol/#toString. Improve Errors #332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
std/assembly/error.ts
Outdated
@@ -1,12 +1,11 @@ | |||
export class Error { | |||
|
|||
name: string = "Error"; | |||
message: string; | |||
stack: string = ""; // TODO | |||
stack: string | null = null; // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afaik this is never null
in JS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it could be undefined according to this
Or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually Error.prototype.stack
is not standard but all browsers support it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial though was that if it's guaranteed to be a string, even if empty, one can simply print it without having to check explicitly, which is about what you'd do in JS because it's effectively always there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll revert this
std/assembly/symbol.ts
Outdated
} | ||
return "Symbol()"; | ||
if (idToString !== null && idToString.has(id)) str = idToString.get(id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this should be the default case of the switch above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, make sense
Thanks! :) |
What about |
Yes, but I mean class ArrayBuffer {
...
get [Symbol.toStringTag]() { // should be added
return 'ArrayBuffer';
}
...
}
Object.prototype.toString.call(new ArrayBuffer()); // to make this work |
While the symbols are there, these aren't really supported yet. |
makes sense, thanks for the explanation |
No description provided.