Skip to content

Conversation

krux02
Copy link
Contributor

@krux02 krux02 commented Aug 8, 2017

No description provided.

@dom96
Copy link
Contributor

dom96 commented Aug 9, 2017

Wow. This sure is a wide reaching change.

I'm pretty sure this will cause a lot of breakage.

@krux02
Copy link
Contributor Author

krux02 commented Aug 14, 2017

Well yes it does, but it is a wanted change in the language as I discussed it often with Araq in the irc chat. (sorry again for no link, but you can ask if you have doubt). There is one thing that causes problems though, and that is the '\0' termination of strings. At the moment all strings have an extra byte for the '\0' terminator. And some code relies on the fact that when there is a string, there will always be an extra '\0' character at the end. The empty string breaks this.

var s: string  # is should now behave like an empty string
echo s[0]      # on an empty '\0' terminated string this should be '\0', 
               # but here it reads the nil pointer and crashes.

I don't think that a nil check on the index operator is feasible.

@krux02
Copy link
Contributor Author

krux02 commented Aug 14, 2017

I don't have any knowledge about the javascript, nor the javascript backend, so I would need help for that part. Even better if someone would take that part over.

@Araq
Copy link
Member

Araq commented Aug 15, 2017

Even better if someone would take that part over.

Only compiler frontend issues are affected, the JS backend knows about it already.

@Araq
Copy link
Member

Araq commented Apr 28, 2018

merged manually.

@Araq Araq closed this Apr 28, 2018
@krux02
Copy link
Contributor Author

krux02 commented Apr 29, 2018

wow, that was a tough one I guess.

@krux02 krux02 deleted the no-nil-strning branch August 23, 2019 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants