Skip to content
This repository has been archived by the owner on May 29, 2018. It is now read-only.

[SUGGESTION] Standard string format? #23

Open
aponigricon opened this issue Feb 22, 2013 · 4 comments
Open

[SUGGESTION] Standard string format? #23

aponigricon opened this issue Feb 22, 2013 · 4 comments

Comments

@aponigricon
Copy link
Contributor

Both in AtlasOS and now also here in Atlas2, you've decided to use null-terminated strings as the standard string format both for system constants, and in the standard API...
But what about quitting using null-terminated strings and evolve our operating system's infrastructure completely by using length-prefixed strings?

I could write multi-dimensional arrays containing arguments for p-strings, and disadvantages of t-strings, but let me just leave a few mere hyperlinks: 😉
http://en.wikipedia.org/wiki/String_(computer_science)#Null-terminated
http://en.wikipedia.org/wiki/String_(computer_science)#Length-prefixed
http://en.wikipedia.org/wiki/Null-terminated_string#Limitations

@noxer
Copy link
Member

noxer commented Feb 23, 2013

Its an interesting suggestion. I thought about that too. The only reason not to do it is the compatibility to C. A second issue is, that we waste one byte per character when using one word to save it. How about a length-prefixed compressed string?

@aponigricon
Copy link
Contributor Author

C is a very weak language compared to the possibilities with DASM-16. We're better off making our own language... COMAL, anyone?

And a P-string uses the exact same amount of words as a T-string, so I don't think I understand what you mean by that it wastes a byte or whatever.

And compressed length-prefixed strings is indeed a possibility, but would be quite annoying to hardcode into the system...

@aponigricon
Copy link
Contributor Author

If we're going to make our own programming language, should it be strongly typed, or weakly?

I can imagine that most of the people who are going to use it are probably the users themselves who need to write fast, imperative scripts... thus a weak typing paradgim should be the best option?

@noxer
Copy link
Member

noxer commented Mar 1, 2013

Its depends. A scripting language should be weakly typed. A precompiled language (maybe at install time or first run) should be strongly typed so we can optimize it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants