Casting can be implemented via small assembler routines. For example in
http://www.purebasic.fr/english/viewtopic.php?t=32678 the casting of integer to float is handled with this function:
Code: Select all
Procedure.f Float(i.l)
Protected Ar.f
!FILD dword [p.v_i]
!FSTP dword [p.v_Ar]
ProcedureReturn Ar
EndProcedure
But the lack of casting and the lack of [non-conditional] Boolean expressions does highlight some fundamental shortcomings of PureBasic.
I would very much like to see development on PB 4.4 being all about 'Back to Basics'. Stop focussing for a while on the development of sophisticated library routines (welcome though they are) and concentrate on getting the core of PureBasic working properly, especially in the area of arithmetic expressions and mathematics. Virtually every program relies upon arithmetic being 100% reliable and highly convenient, but unfortunately this is not always the case with Pure Basic.
Here are some of the 'Back to Basic' areas that I feel need attention:
* Boolean expressions should be supported in assignment statements
* An expression should be allowed in the STEP clause of FOR
* FOR statements should work with all integer types, including quads
* Pow() and Log() and Log10() should all work at full double accuracy
* (Minor) The operator ' ^ ' should be available for the raising of powers e.g. 2^3
* Some fundamental missing funtions are missing, such as:
Max() Min() Sgn() String() and of course Abs() for integers
* SHAREd variable declarations within procedures should not need an spurious additional DEFINE statement when EnableExplicit is in effect
* Macros still need additional features to be fully useful
The one library that I think should still be improved in a major way is the Date library which I feel is reaching a crisis. It supports dates to only 19-Jan-2038. But this date is now very close. I can no longer use it with database related programs as (for example) the retirement date of many young adults now well exceeds this date. I ended up having to write my own comprehensive set of quad based date/time routines, but I would have preferred to be able to use the built-in routines instead.
Despite all the above negative comments, I really love PureBasic. It was one of the best purchases I ever made.