Shop OBEX P1 Docs P2 Docs Learn Events
Why is PBASIC so clunky? — Parallax Forums

Why is PBASIC so clunky?

ArchiverArchiver Posts: 46,084
edited 2002-04-19 01:04 in General Discussion
Something that has bugged me from day-1 about PBASIC.

How come it lacks basic and obvious programming structure constructs,
stuff like:

if/then/else
case
while/wend
repeat/until
begin/end blocks

I mean, this stuff would be trivial to add to the compiler, it ought
to be a couple of days work at most, and it would make programs so
much easier to write and to read -- and isn't that the point of
educational use of basic stamps anyway? It's hard to write good code
that others can understand when it contains a bunch of gotos.

Dartmouth Basic, back 30 years ago, had many of these constructs.
PBASIC ought to as well.

Best
R

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-04-14 21:25
    PBASIC was designed to be very close to its core micro and, as such, is very
    trim by design. This allows it to be very efficient, even if a "high level"
    language.

    That said, we recognize that most of our customers are coming from modern
    desktop BASICs and are accustomed to the programming structures you
    indicated. So, we have, in fact, started on a compiler update that will
    bring these structures to our BASIC Stamps. You are seriously wrong,
    however, in that the update will take just a couple of days. That kind of
    work might be fine for our would-be competitors, but not for us. We will be
    as diligent as possible in our approach and it will take more than a couple
    of days. We typically spend a couple of months internally testing compiler
    changes after we think it's done and even with that there are occasional
    problems.

    -- Jon Williams
    -- Applications Engineer, Parallax


    In a message dated 4/14/02 2:43:07 PM Central Daylight Time,
    trebor@a... writes:


    > Something that has bugged me from day-1 about PBASIC.
    >
    > How come it lacks basic and obvious programming structure constructs,
    > stuff like:
    >
    > if/then/else
    > case
    > while/wend
    > repeat/until
    > begin/end blocks
    >
    > I mean, this stuff would be trivial to add to the compiler, it ought
    > to be a couple of days work at most, and it would make programs so
    > much easier to write and to read -- and isn't that the point of
    > educational use of basic stamps anyway? It's hard to write good code
    > that others can understand when it contains a bunch of gotos.



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-14 22:25
    Jon:

    Don't change a thing in the way you guys develope ANYTHING. I keep
    coming back after try the Brand X (hint) devices and after much hair pulling
    I throw the STamp back in the circuit and keep on trucking..

    By the way, two of your stamp 2's are about to control a 11' 3" long R/C
    submarine...

    Mike B.

    Original Message
    From: <jonwms@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Sunday, April 14, 2002 1:25 PM
    Subject: Re: [noparse][[/noparse]basicstamps] Why is PBASIC so clunky?


    > PBASIC was designed to be very close to its core micro and, as such, is
    very
    > trim by design. This allows it to be very efficient, even if a "high
    level"
    > language.
    >
    > That said, we recognize that most of our customers are coming from modern
    > desktop BASICs and are accustomed to the programming structures you
    > indicated. So, we have, in fact, started on a compiler update that will
    > bring these structures to our BASIC Stamps. You are seriously wrong,
    > however, in that the update will take just a couple of days. That kind of
    > work might be fine for our would-be competitors, but not for us. We will
    be
    > as diligent as possible in our approach and it will take more than a
    couple
    > of days. We typically spend a couple of months internally testing
    compiler
    > changes after we think it's done and even with that there are occasional
    > problems.
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    >
    >
    > In a message dated 4/14/02 2:43:07 PM Central Daylight Time,
    > trebor@a... writes:
    >
    >
    > > Something that has bugged me from day-1 about PBASIC.
    > >
    > > How come it lacks basic and obvious programming structure constructs,
    > > stuff like:
    > >
    > > if/then/else
    > > case
    > > while/wend
    > > repeat/until
    > > begin/end blocks
    > >
    > > I mean, this stuff would be trivial to add to the compiler, it ought
    > > to be a couple of days work at most, and it would make programs so
    > > much easier to write and to read -- and isn't that the point of
    > > educational use of basic stamps anyway? It's hard to write good code
    > > that others can understand when it contains a bunch of gotos.
    >
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-14 22:33
    Mike:

    I forgot to mention that we do have another product near release that
    includes fully structured programming: the Javelin Stamp. It programs in a
    subset of Sun's Java but is as easy to use as a BASIC Stamp (and will fit in
    the same socket).

    Details at: www.javelinstamp.com

    -- Jon Williams
    -- Applications Engineer, Parallax


    In a message dated 4/14/02 4:30:29 PM Central Daylight Time,
    w6ffc@p... writes:


    > Jon:
    >
    > Don't change a thing in the way you guys develope ANYTHING. I keep
    > coming back after try the Brand X (hint) devices and after much hair pulling
    > I throw the STamp back in the circuit and keep on trucking..
    >
    > By the way, two of your stamp 2's are about to control a 11' 3" long R/C
    > submarine...
    >
    >




    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-14 23:23
    >PBASIC was designed to be very close to its core micro and, as such, is very
    >trim by design. This allows it to be very efficient, even if a "high level"
    >language.

    With all due respect (and I'm not trying to pick a fight here),
    efficiency issues for basic constructs (like if/then/else or
    while/wend for example) have little or nothing to do with the
    constructs themselves, and everything to do with the efficiency of
    the compiler and the structure of the target operation set (which I
    would assume is some sort of icode in the case of the Basic Stamp).


    >That said, we recognize that most of our customers are coming from modern
    >desktop BASICs and are accustomed to the programming structures you
    >indicated. So, we have, in fact, started on a compiler update that will
    >bring these structures to our BASIC Stamps.

    That's good news.

    > You are seriously wrong,
    >however, in that the update will take just a couple of days.

    You will note that I said it would only take a couple of days to
    *add* the features, I have no problems with you taking the time to
    test then properly. I've written more than a handful of compilers in
    my time, so I don't think I'm too far off in my estimate.

    Please don't get the impression I'm trying to get on Parallax's case,
    it was not intended that way. I'm having a lot of fun playing with
    the SX2, it reminds me of the days of my youth when clock speeds were
    measured in kilohertz and one had to code with care and elegance.

    Just managed to get the little beast to simultaneously trigger and
    poll 8 ultrasonic sensors, compute the evasion trajectory for
    multiple detected objects and get >10 updates a second. Would like
    to run it faster, but it's somewhat of trial and error to find out
    what code constructs run the fastest. Is there any doco out there
    about operation speeds?

    Best
    R
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-15 01:19
    Hard to answer without seeing your code, however, BRANCH generally runs
    faster than IF-THEN and may help. Also, using READ (from EEPROM table)
    instead of LOOKUP seems to work faster in programs I've taken the time to
    analyze.

    -- Jon Williams
    -- Parallax


    In a message dated 4/14/02 6:03:17 PM Central Daylight Time,
    trebor@a... writes:


    > Just managed to get the little beast to simultaneously trigger and
    > poll 8 ultrasonic sensors, compute the evasion trajectory for
    > multiple detected objects and get >10 updates a second. Would like
    > to run it faster, but it's somewhat of trial and error to find out
    > what code constructs run the fastest. Is there any doco out there
    >




    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-15 19:37
    I've made the argument before that many brain-dead aspects of the BS2 that
    you could build this kind of functionality into the editor, as a sort of a
    preprocessor. One of the most obnoxious things IMO about the BS2 basic is
    the conditional branching approach. It reminds me strongly of my days of
    programming the 6502 microprocessor without an assembler, and the result
    is that to do anything vaguely complex you have to fill the code base with
    so many unnecessary labels that it becomes unreadable. With a little
    logical structure (gosub on condition, execute complex statement on
    condition, perhaps an argumented function approach) it could look a heck
    of a lot cleaner, and I Think most of it could be in the editor so the BS2
    itself wouldn't see a change.


    On Sun, 14 Apr 2002, Robert Woodhead wrote:

    > >PBASIC was designed to be very close to its core micro and, as such, is very
    > >trim by design. This allows it to be very efficient, even if a "high level"
    > >language.
    >
    > With all due respect (and I'm not trying to pick a fight here),
    > efficiency issues for basic constructs (like if/then/else or
    > while/wend for example) have little or nothing to do with the
    > constructs themselves, and everything to do with the efficiency of
    > the compiler and the structure of the target operation set (which I
    > would assume is some sort of icode in the case of the Basic Stamp).
    >
    >
    > >That said, we recognize that most of our customers are coming from modern
    > >desktop BASICs and are accustomed to the programming structures you
    > >indicated. So, we have, in fact, started on a compiler update that will
    > >bring these structures to our BASIC Stamps.
    >
    > That's good news.
    >
    > > You are seriously wrong,
    > >however, in that the update will take just a couple of days.
    >
    > You will note that I said it would only take a couple of days to
    > *add* the features, I have no problems with you taking the time to
    > test then properly. I've written more than a handful of compilers in
    > my time, so I don't think I'm too far off in my estimate.
    >
    > Please don't get the impression I'm trying to get on Parallax's case,
    > it was not intended that way. I'm having a lot of fun playing with
    > the SX2, it reminds me of the days of my youth when clock speeds were
    > measured in kilohertz and one had to code with care and elegance.
    >
    > Just managed to get the little beast to simultaneously trigger and
    > poll 8 ultrasonic sensors, compute the evasion trajectory for
    > multiple detected objects and get >10 updates a second. Would like
    > to run it faster, but it's somewhat of trial and error to find out
    > what code constructs run the fastest. Is there any doco out there
    > about operation speeds?
    >
    > Best
    > R
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and Body
    of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >

    Sean T. Lamont, CTO / Chief NetNerd, Abstract Software, Inc. (ServNet)
    Seattle - Bellingham - Vancouver - Portland - Everett - Tacoma - Bremerton
    email: lamont@a... WWW: http://www.serv.net
    "Do not fear mistakes, There Are None" - Miles Davis
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-16 04:46
    Jon,
    are you guys planning to 'fix' I2CIn and I2COUT commands so they can
    take null address in order to use it with non-memory products (LCD
    displays, etc.
    Thanks,
    Arthur

    --- In basicstamps@y..., jonwms@a... wrote:
    > PBASIC was designed to be very close to its core micro and, as
    such, is very
    > trim by design. This allows it to be very efficient, even if
    a "high level"
    > language.
    >
    > That said, we recognize that most of our customers are coming from
    modern
    > desktop BASICs and are accustomed to the programming structures you
    > indicated. So, we have, in fact, started on a compiler update that
    will
    > bring these structures to our BASIC Stamps.

    <snip here>


    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-16 13:28
    Yes. That upgrade will be announced shortly. We also extended the clock
    hold timeout to give "intelligent" I2C devices more time for internal
    processing.

    -- Jon Williams
    -- Parallax


    In a message dated 4/15/02 10:49:04 PM Central Daylight Time, m5art@y...
    writes:


    > are you guys planning to 'fix' I2CIn and I2COUT commands so they can
    > take null address in order to use it with non-memory products (LCD
    >




    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-19 01:04
    Take a look at "Inside The Basic Stamp II" book by Brian Forbes
    Original Message
    From: "Robert Woodhead" <trebor@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Sunday, April 14, 2002 3:23 PM
    Subject: [noparse][[/noparse]basicstamps] Re: Why is PBASIC so Clunky?


    > >PBASIC was designed to be very close to its core micro and, as such, is
    very
    > >trim by design. This allows it to be very efficient, even if a "high
    level"
    > >language.
    >
    > With all due respect (and I'm not trying to pick a fight here),
    > efficiency issues for basic constructs (like if/then/else or
    > while/wend for example) have little or nothing to do with the
    > constructs themselves, and everything to do with the efficiency of
    > the compiler and the structure of the target operation set (which I
    > would assume is some sort of icode in the case of the Basic Stamp).
    >
    >
    > >That said, we recognize that most of our customers are coming from modern
    > >desktop BASICs and are accustomed to the programming structures you
    > >indicated. So, we have, in fact, started on a compiler update that will
    > >bring these structures to our BASIC Stamps.
    >
    > That's good news.
    >
    > > You are seriously wrong,
    > >however, in that the update will take just a couple of days.
    >
    > You will note that I said it would only take a couple of days to
    > *add* the features, I have no problems with you taking the time to
    > test then properly. I've written more than a handful of compilers in
    > my time, so I don't think I'm too far off in my estimate.
    >
    > Please don't get the impression I'm trying to get on Parallax's case,
    > it was not intended that way. I'm having a lot of fun playing with
    > the SX2, it reminds me of the days of my youth when clock speeds were
    > measured in kilohertz and one had to code with care and elegance.
    >
    > Just managed to get the little beast to simultaneously trigger and
    > poll 8 ultrasonic sensors, compute the evasion trajectory for
    > multiple detected objects and get >10 updates a second. Would like
    > to run it faster, but it's somewhat of trial and error to find out
    > what code constructs run the fastest. Is there any doco out there
    > about operation speeds?
    >
    > Best
    > R
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
Sign In or Register to comment.