BBC BASIC for Windows
« Posibility of stict variable types in BB4W? »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:11pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Posibility of stict variable types in BB4W?  (Read 473 times)
Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Posibility of stict variable types in BB4W?
« Thread started on: Nov 3rd, 2009, 12:28pm »

I was just thinking about the possibility of introducing a new mode eg a *FLOAT mode which would guarantee variables are only interpreted as either integers, FLOAT 40's or FLOAT 64's.

So,
& - bytes or char
%- signed 32-bit integers
f - 32 bit floats
- 40 bit floats
# - 64 bit floats

You would not be able to use integers in 40 or 64 bit floats. Would this be difficult to implement? What would the backward compatibility problems be? Would this be faster? And, would this lead to a true compiler for BB4W?

I would be interested in other peoples thoughts.

Michael
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Posibility of stict variable types in BB4W?
« Reply #1 on: Nov 3rd, 2009, 3:28pm »

Quote:
You would not be able to use integers in 40 or 64 bit floats. Would this be difficult to implement?

Why would you want to take such an apparently retrograde step? The trend in BASICs has for a long time been away from strongly-typed numeric variables towards variant numerics.

For example most BASICs of the 1980s used strongly-typed numerics, like the original BBC BASIC and QBASIC/QuickBasic. At the other extreme, ANSI BASIC and Liberty Basic both have only variant numerics. BB4W lies somewhere in between, with both explicit integer variables and variants.

My BBC BASIC (Z80) was probably one of the earliest BASICs to support variant numerics (integer/40-bit float) and BB4W has extended this to provide integer/40f/64f variants.

So it seems strange to me that you should want to turn the clock back. What you are asking for (floating point variables which cannot contain integers) is exactly what you get in Acorn versions of BBC BASIC and Brandy!!

Quote:
What would the backward compatibility problems be?

Adding extra variable types wouldn't necessarily introduce significant incompatibilities, but there aren't any suitable remaining sigil characters, so how would you represent them?

Quote:
Would this be faster? And, would this lead to a true compiler for BB4W?

If implemented by means of a new *FLOAT mode (as you seemed to suggest) it would of course be slower, not faster, because (being an interpreter) BB4W would have to test the current mode whenever it needed to do something different depending on whether the variable was a variant or a 'strict' float. The number of places where such a test would need to be added is large!

It has no specific bearing on compiling BBC BASIC as far as I can see; why should it?

Richard.
« Last Edit: Nov 3rd, 2009, 4:20pm by admin » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls