Compiler or language enhancements
Posted: Fri Sep 28, 2012 4:10 pm
The fact the Hugo Compiler is written in C shows through in a thing I have noticed - and spoken about here before - that the language is extremely weak on: string support. C has horrible string support and most string processing in C is a kluge made using baling wire (but since the string functions are weak, it's not attached with or using string!) to a bag attached by Scotch Tape to the compiler.
Now, you look at a language like the current levels of Pascal, or even Basic, which both have excellent string support, and you realize just how weak the string support is either in C or in Hugo.
And that's one thing Hugo really needs, if there's an update to the compiler, since it's a text-processing application, it needs native string capability. It needs the ability for an object to be a sting and to provide full string processing of strings and possibly string arrays.
If arrays containing characters can be manipulated to compress or expand the array through library functions now, then it's possible to simulate some of these functions, but I think the language needs the capacity for string manipulation, badly. Especially since the game development system TADS was written using Pascal, I wouldn't be surprised if it had better string processing, although I don't know as I've not looked at the language.
Left (take the first N charaters), right (take the last N), mid( take N characters starting at character M), as well as string insert (at character N, insert this string, expanding the string to add this), Len(length of string), string search( find substring in string and return position or 0 if not found).
The ability to handle words not in the dictionaries would be useful but it's not critical. And possibly better math routines but that can be programmed if it's really necessary. The fact that the Hugo compiler doesn't support real numbers is another artifact of it's days as a 16-bit application where floating point operations required either a coprocessor - floating point being not included in the base CPU and often costly to add as a coprocessor - or expensive software-based floating point.
I mean, even PHP, which is based on C, has fairly good string processing functionality.
So, does anyone else have ideas of things the Hugo language either needs better support for or that it should have as additional capability?
Now, you look at a language like the current levels of Pascal, or even Basic, which both have excellent string support, and you realize just how weak the string support is either in C or in Hugo.
And that's one thing Hugo really needs, if there's an update to the compiler, since it's a text-processing application, it needs native string capability. It needs the ability for an object to be a sting and to provide full string processing of strings and possibly string arrays.
If arrays containing characters can be manipulated to compress or expand the array through library functions now, then it's possible to simulate some of these functions, but I think the language needs the capacity for string manipulation, badly. Especially since the game development system TADS was written using Pascal, I wouldn't be surprised if it had better string processing, although I don't know as I've not looked at the language.
Left (take the first N charaters), right (take the last N), mid( take N characters starting at character M), as well as string insert (at character N, insert this string, expanding the string to add this), Len(length of string), string search( find substring in string and return position or 0 if not found).
The ability to handle words not in the dictionaries would be useful but it's not critical. And possibly better math routines but that can be programmed if it's really necessary. The fact that the Hugo compiler doesn't support real numbers is another artifact of it's days as a 16-bit application where floating point operations required either a coprocessor - floating point being not included in the base CPU and often costly to add as a coprocessor - or expensive software-based floating point.
I mean, even PHP, which is based on C, has fairly good string processing functionality.
So, does anyone else have ideas of things the Hugo language either needs better support for or that it should have as additional capability?