0x10cAtlas / atlas2

The new version of AtlasOS.
MIT License
6 stars 3 forks source link

[SUGGESTION] Standard string format? #23

Open aponigricon opened 11 years ago

aponigricon commented 11 years ago

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: :wink: 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 commented 11 years ago

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 commented 11 years ago

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 commented 11 years ago

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 commented 11 years ago

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.