Showing posts with label inspector. Show all posts
Showing posts with label inspector. Show all posts

Debugging Run BASIC Web Apps

In Run BASIC's first release there is effectively no built-in debugger. Of course you can use print to log to the browser page or to a file, and this is no more or less than many other web scripting systems. We aim to do something about this in the very near future.

One of our users suggested that it would be good to create an inspector panel in Run BASIC itself and that we should add some reflection via an EVAL$() function that would allow arbitrary execution of BASIC code at runtime. We would probably also need to at least metaprogramming features like the ability to get information from the runtime like:
  • The name of the current context (ie. function or subroutine)
  • The names of all the variables and arrays in scope
  • The source code for the current context
  • A collection of objects that models the stack
  • Probably more stuff

While this sort of thing is possible I think that we probably will initially provide a high level runtime inspection panel that the programmer can show and hide as needed. This is BASIC after all, and it should be as easy as possible to use. The metaprogramming stuff is cool though. ;-)

Web Debugging

The topic of web debugging in Run BASIC came up today in the forums, and the topic started with some ambitious ideas from Bill W. who always has something interesting to say (here for example).

Run BASIC does need a debugging facility. I realize that most web programmers probably write to logs, and you can do that in RB without adding anything but we can make it a lot easier. Just for starters I was thinking of adding a logging object of some kind. A debug button would be added to the toolbar, and then you could specify either logging of all variable changes, or specify watches so that only certain variables would get logged, and a LOG statement could also be added that would only log if the program is executed in debug mode (instead of merely run).

Also, it would be no hard matter to include an inspector object which could be rendered into the page whereever it is convenient for the programmer. You could examine and change the value of variables, and perhaps even execute code dynamically on a running program in the web browser.

I'm eager for feedback on this!

Check out this stream