NotSoBASIC

As discussed in a previous posting, I’ve been musing over the development of a modernised version of the classic procedural BASIC language, especially with the Raspberry Pi in mind.

With this in mind I’ve been setting out some goals for a project and working a little on some of the syntactical details to bring structures, advanced for-loop constructs and other modern features to a BASIC language as backwardly compatible with the old Sinclair QL SuperBASIC as possible.

So, here are the goals:

  1. The language is aimed at both the 13 year old bedroom coder, getting him/her enthused about programming, and the basic needs of general scientist. (Surprisingly, the needs of these two disparate groups are very similar.)
  2. It must be platform agnostic and portable. It must also have a non-restrictive, encumbered license, such as the GPL, so probably Apache, so as to allow it to be implemented on all platforms, including Apple’s iOS.
  3. It must have at least two, probably three, levels of language, beginner, standard and advanced. The beginner would, like its predecessors in the 8bit era, be forced to use line numbers, for example.
  4. It must have fully integrated sound and screen control available simply, just as in the old 8bit micro days. This, with the proper manual, allow a 13 year old to annoy the family within 15 minutes of the person starting to play.
  5. The graphical capability must include simple ways to generate publishable scientific graphical output both to the screen and as encapsulated Postscript, PDF and JPEG.
  6. The language must have modern compound variables, such as structures, possibly even pseudo-pointers so as to be able to store references to data or procedures and pass them around.
  7. The language should be as backwardly compatible with Sinclair QL SuperBASIC as possible. It’s a well tested language and it works.
  8. The language should be designed to be extendable but it is not envisaged that this would be in the first version.
  9. The language IS NOT designed to be a general purpose application development language, though later extensions may give this ability.
  10. The language will have proper scoping of variables with variables within procedures being local to the current call, unless otherwise specified. This allows for recursion.
  11. All devices and files are accessed via a URI in an open statement.
  12. Channels (file descriptors) must be a special variable type which can be stored in arrays and passed around.

As I said earlier, I’ve been thinking about how to do a great deal of this syntactically as well. This is where I’ve got so far:

[Edit: The latest version of the following information can be found on my website. The  information below was correct at 10am 23rd February 2012.]

Variables.

Variable names MUST start with a alphabetic character and can only contain alphabetic, numeric and underscore characters. A suffix can be appended so as to give the variable a specific type, e.g. string. Without a suffix character the variable defaults to a floating point value.

Suffixes are:

$ string
@ pointer

Compound variables.

Compound variables (structures) can be created using the “DEFine STRUCTure” command to create a template and then creating special variables with the “STRUCTure” command:

DEFine STRUCTure name
varnam
[…]
END STRUCTure

STRUCTure name varnam[,varnam]

An array of structures can also be created using the STRUCTure command, e.g.

STRUCTure name varnam(3)

The values can be accessed using a “dot” notation, e.g.

DEFine STRUCTure person
name$
age
DIMention vitals(3)
END STRUCTure

STRUCTure person myself, friends(3)

myself.name$ = “Stephen”
myself.age = 30
myself.vitals(1) = 36
myself.vitals(2) = 26
myself.vitals(3) = 36

friends(1).name$ = “Julie”
friends(1).age = 21
friends(1).vitals(1) = 36
friends(1).vitals(2) = 26
friends(1).vitals(3) = 36

As with standard arrays, arrays of structures can be multi-dimentional.

Structures can contain any number of standard variables, static arrays types and other structures. However, only structures defined BEFORE the one being defined can be used. Structure definitions are parsed before execution of the program begins. Structure variable creation takes place during execution.

Loops.

FOR/NEXT:

FOR assignment (TO expression [STEP expression] | UNTIL expression | WHILE
expression) [NEXT assignment]
..
[CONTINUE]
..
NEXT [var]

The assignment flags the variable as the loop index variable. Loop index variables are normal variables.

The assignment and the evaluation of the assignment expression happen only once, when entering the loop. The test expressions get evaluated once every trip through the loop at the beginning. If the TO or UNTIL expressions evaluate to zero at the time of loop entry the commands within the loop do not get run.

The STEP operator can only be used if the loop index variable is either a floating point variable or an integer. The expression is evaluated to a floating point value and then added to the loop index variable. If the loop index variable is an integer then the value returned by the expression stripped of its factional part (as with ABS()) before being added to the variable.

WHILE/END WHILE:

WHILE expression [NEXT assignment]

[CONTINUE]

END WHILE

Equivalent to a FOR loop without an assignment using the WHILE variant e.g.

x = 10
WHILE x > 3 NEXT x += y / 3

END WHILE

is equivalent to

FOR x = 10 WHILE x > 3 NEXT x += y / 3

NEXT

DO/UNTIL:

DO

[CONTINUE]

UNTIL expression

The commands within the loop are run until the expression evaluates to a non-zero value.

Functions and procedures.

A function is merely a special form of a procedure which MUST return a numeric value. The suffix of a procedure determines its type, in the same way as variable names.

DEFine PROCedure name[(parameter[,parameter[…]])]

[RETURN expression]
END PROCedure

DEFine FUNction name[(parameter[,parameter[…]])]

RETURN expression
END FUNction

Parameters are local names with reference the passed values by reference. This means that any modification of the parameters within the procedure will change the value of any variables passed to it.

Variables created within the procedure will be local to the current incarnation, allowing recursion. Variables with global scope are available within procedures but will be superseded by any local variables with the same name.

Joining the fast lane: Fibre to the Cabinet broadband Internet access is here.

Well, after quite a wait the Cowley BT telephone exchange has finally been enabled for Fibre to the Cabinet (FTTC) broadband. Even using BT’s own estimate, the exchange has been nearly two month late coming on-line.

So, what does having the new service involve?

Well, other than a hefty £80+VAT fee, it merely requires a BT Openreach engineer to visit your house and install a modem and additional face-plate filter onto the house’s master “line” socket and then go to the street cabinet containing your connection to rewire it. You will also need a firewall/router which can talk PPPoE. In other words, one which can use a network cable instead of a phone cable. These are the same as those used with Virgin Media cable-modems.

Although BT (via your ISP) will inform you that the process will take up to an hour, in fact it takes a lot less time than this, It’s about 5 minutes for the engineer to unpack the new modem and fix the faceplate and then a further 10 minutes while he hunts for the correct street cabinet and re-wires your phone line. Assuming that you have your router fully set up beforehand that’s it. He just does a few tests and leaves.

In my case, I had a Billion BiPAC 7800N router which can do both ADSL (phone line) and connect via a network cable so all I needed to do was change a setting and reboot it.

So, this, after some tidying, is my new communications system:

Now that everything’s wall mounted and I’ve put all the wires into a conduit it looks a whole lot neater than before. Also, it’s unlikely to be knocked or cables snagged.

At the top of the picture you can see the Billion router. It’s not much to look at but it is a superb router. I do like the way that it can be mounted vertically on the wall, thus taking less space laterally.

Below the router is the BT modem. Thankfully this is the mark 3 model so is less likely to die horribly.

Finally, connected directly into the wall power socket is the Devolo 200Mb/s power line networking module. This connects to a similar unit in the spare bedroom, where my server sits, and to a multi-port power-line network switch in the living room to which is connected the TV, PS3 and amplifier.

So, what does all this shiny new equipment give me over and above what I had before? Other than the 10 times download speed increase and the four times upload speed jump, it also means that the connection should be far more stable. I’m also only paying about £3 more for this service than I was for the ADSL MAX service I was previously on and I get an extra 30GB of download quota bundled in with it.

Basically, I’m happy with it and that’s all that matters.

[Edited to add historical broadband speed test data]

Surviving the stigma: The under cover geek.

A recent experience has made me aware at how much pressure I feel about hiding my geekiness and how I’ve gained over the years mental defence mechanisms and automatic self-censoring of my expression so as to seem “normal” around others in social situations.

I have become aware that I have a semi-concious editor metaphorically sitting on my shoulder observing me and suggesting ways to avoid mentioning anything to do with SciFi stories, quotes from films or technology unless someone else mentions it first. There’s a constant feeling that I should hide this side of me.

I think a great deal of this comes from my experiences at school. I was never in the in-crowd. In fact, I was often shunned and left out of all groups and bullied. This meant that I gathered quite a few coping strategies over the years, one of which is an automatic dulling, if not total suppressing, of all emotion if I find myself in a stressful situation. It’s very probably a very unhealthy thing to have but it was the only defence I had so as to cope in many of those years.

During the recent experience I mentioned earlier I found myself suppressing the geek side of myself more and more, fearful that the person I was trying to impress would not accept that side of me. This became highly stressful.

I’d like to be able to release my inner geek and have “geek pride” but the defence systems are now so firmly ingrained that I fear I can never be rid of them, unless in the company of know geeks.

So, why does society have this reaction to geeks? Well, I imagine that it’s because they are different. The normal will always look on the slightly eccentric with suspicion. Of course, the most extreme end of geekiness can be rather anti-social, but so can the extreme end of the normal womaniser or the normal alcoholic.

Anyway, it’s sad, but that’s the way society is. I’ll just have to try to deal with it and interface with it on its own terms.

 

Musings on Internet dating.

Having tried Internet dating for some time and getting absolutely nowhere it was interesting to read about some research done in the USA into how this technology is being used and seen by those using it. The results definitely resonated with my experience and those I’ve talked to who have also tried it.

From my own experience and that of those of the opposite sex I’ve talked to (except for a couple of notable exceptions) it seems that the great majority of both men and women who frequent the sites treat it more or less like an on-line shopping experience, with all the consumer ideas of the perfect product which this entails.

There does seem, however, to be a marked difference between what the two genders seem to be looking for in this retail experience.

As for the women, there seem to be two types on the sites, those looking in the most part for a perfect, boxed, shrink-wrapped “bFriend 2” with money-back guarantee and those with children who seem to be looking for an emotional crutch and child minder. Those who are the most picky seem to be the ones who have been through a divorce. This is understandable in a way as they don’t want to submit themselves to the same hurt and pain as they’ve experienced in the past.

The majority of the men are looking for something very different. They seem to see dating sites as seedy singles bars with needy women ready to do anything for “love” and this, from the shocking stories I’ve heard, mostly seem to involve kinky sex.

So, what about these sites which purport to offer a “scientific” matching system. Well, as the report mentioned above put it, they’re not exactly scientific. I’ve filled out the whole slew of personality profile questionnaires and very often the “matches” it gives (from the very small selection available) are very often laughable.

In my experience, the sites which have put the most emphasis upon complex matching have been the least able to supply any meaningful connections. Indeed, in my experience, the site which makes the most of its matching ability and advertises so on the TV never once gave me any matches who would respond to a simple “Hello”, let alone actually meet someone.

In addition, the advertising intimates that there are thousands of members of the opposite sex just waiting to get in touch with you when you join. Well, there are thousands of members, possibly thousands which match your criteria globally. However, if you trim it down to those who are actually within a realistic distance to make the logistics work and then filter out the vast majority of the members who are inactive (or merely spam-bots) you get down to a very, very small number, in the low hundreds, more likely in the tens. New member seem to appear in quite small numbers too, probably no more than five a week, on a good week, and most of those become disillusioned so quickly that they can be thought of as inactive members.

What’s even more problematic is that all these sites charge an exorbitant amount of money per month for this “service”. I have no gripe with paying for a service but some of these sites charge nearly £20. There is no way that a simple web interface to a database and some simple data extraction logic should cost this much to run. It’s close to being a scam.

So, in these days of isolated, static social circles what is the possible alternative for those who wish to find a partner? Actually, I’m not sure these is one. Internet dating seems to be the only game in town, even if it it is close to useless.
 

 

Mars attacks

Well, Mars is finally getting into a position where I can image it at a reasonable hour of the day (or night).

So, ths evening I had a doze in bed for most of it before getting outside and attempting to get at least one image of Mars.

Mars is rather more difficult to image tham Jupiter due to it being far smaller. Thankfully, for Christmas I got a 5x magnification lens which allows me to make the image on the “webcam” camera large enough to even attempt the task. Even so, with the degree of atmospheric disturbance I never thought I could get anything decent tonight.

Well, surprisingly, after a bit of processing in Registax, this is what I managed to obtain: