Skip to content
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

js: document what cstring.default should be (nil vs "") #517

Open
timotheecour opened this issue Jan 10, 2021 · 0 comments
Open

js: document what cstring.default should be (nil vs "") #517

timotheecour opened this issue Jan 10, 2021 · 0 comments
Labels

Comments

@timotheecour
Copy link
Owner

timotheecour commented Jan 10, 2021

arguments for nil:

func open*(this: XMLHttpRequest; metod, url: cstring; async = true; user = cstring.default, password = cstring.default) {.importjs: "#.$1(#, #, #, #, #)".}

which matches https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/open

The optional user name to use for authentication purposes; by default, this is the null value.

arguments for "":

nil is not a valid value for string in js.
This would treat cstring more like a value type instead of a reference type; but note that in js, string is an immutable, so ref vs value doesn't really matter

if we were to change default value to "", this could be done using something similar to nim-lang#16606 (adapting it for string instead of BigInt)

related links

@timotheecour timotheecour changed the title js: document what cstring.default should be (nil vs "") js: document what cstring.default should be (nil vs "") Jan 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant