Being interested in PHP&MySQL development and having just discovered Yab, I thought about making a simple Haiku program to manage and monitor the HTTP and MySQL servers.
Now PHP is not yet supported, so obviously there’s no rush for me to have this little program completed, but Yab still looks great for such small tasks and I went into its documentation to learn a few things and play with it. However, my first brief contact with BASIC was about 25 years ago, then I learned a little more in high-school, just 2 years later, on a ZX Spectrum clone. Back then, we used GOTO line_number.
Anyway, back to Yab. I ran into two problems.
1. No system tray reference in the documentation
Although I searched quite extensively, even in the online C API, I couldn’t find this kind of info. Can Yab handle this? I would need a status icon in the tray, that would also help to quickly manage the servers from a menu.
2. yab-IDE’s documentation could be more intuitive
Considering my BASIC days are way back in the past, with another dialect, every little bit of help to get back on track with it would be great to save time learning, which is useful even for people completely new to programming (I know the reader is assumed to have some experience with programming). I’ll go through a few examples.
dim - create an array prior to its use
The name section could at least mention this: “create a simple or 2-dimensional array prior to its first use”. And here’s the thing: there’s no other mention if dim can be used to create arrays of 3 or more dimensions, which should be clarified.
The synopsis section could look like this:
dim numericArrayName(xSize, ySize)
dim stringArrayName$(xSize, ySize)
- “array” is a keyword in multiple languages, so this synopsis can mislead programmers into thinking it should be used as such. It’s only the examples section that reveals the fact that “array” is not a keyword in Yab.
- The “$” usage should be properly clarified somewhere in the beginning of the documentation, so people know why and where it’s supposed to be used. But considering people can simply jump to some keyword and miss that explanation, tweaking the variable names can help the readers make the difference between the numeric and string arrays.
- In other programming languages the array dimensions are not defined, or not as in Yab. So
array(x,y)could easily be mistaken for a 1-dimensional array with two values: x and y.
token() - split a string into multiple strings
Unless you read the description very carefully, and also look at the example, you have no idea what $a stands for. Here’s a better synopsis:
And considering the tokens$ array automatically expands if needed, it would be a good idea to suggest the “cheapest” array definition (RAM-wise):
Naming variables is obviously a thing that could be improved in most places in the documentation. I could sit down and suggest replacements for everything, but it would take me more time not to screw up and suggest something wrong, considering I’m still unfamiliar with the language. Still, if help is welcome, I will pitch in here and there - based on what I bump into while learning some yab.
Adding some info about arrays in chapter 4 would be great. The most popular languages are quite advanced at working with arrays, so not having any reference about them makes people wonder about their support in yab - like appending, prepending, searching, etc. I don’t know if I’m barking at the right tree here, considering I have no idea if the yabasic developers hang around here, but I’ll do more research as I move on, if and when. In the meantime I thought it would do good if I posted this here.
I have to say that Michel’s note about arrays was splendid, but it still doesn’t reveal yabasic’s level of support for arrays, and that would be welcome.