Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Questions & More... Questions!
#1
If I make any mistakes in English, I apologize, but it is not my native language.
First of all, I love QB64. I'm 42 now, and it reminds me of when I was 9. I'd like to ask the developers a few questions:

Programming:
1. Are you planning to implement arrays in user-defined types instead of using text strings?
2. Would inheritance be feasible in user-defined types?
3. Could a null numeric value be implemented as NaN? I know that dividing by zero gives “INF” (or “-INF”), and a NaN value could be detected from a function... but could it be implemented as a constant?

IDE:
1. Although double-clicking on $INCLUDE opens another IDE with that file, would it be possible to implement a “Window” menu?
2. In the color configuration (themes) section, why do the metacommands match the same color as the methods? Also, could there be a section dedicated to the color of variables/constants/UDTs?

Thank you for this great software.

Translated with DeepL.com (free version)
Reply
#2
I DO NOT speak for the QB64PE development team.  But I do have some observations. 

   I'm not quite sure what you mean by question 1.    Arrays of USER DEFINED TYPES are possible now.   
I use them often.


Inheritance is probably POSSIBLE,   but when I answer a question with the word Possible I always like 
to emphasize that          POSSIBLE <>  Easy/Practical/Likely.

Inheritance might be nice to have for some applications but I personally don't see it in keeping with the
spirit of the project or the BASIC language !    That is only my opinion though !. 

To question 3 I have a similar reaction as to the inheritance concept.   I don't really see the point TBH. 
ON ERROR GOTO can catch division by Zero errors or you can always precheck prior to the division
in your own code !
Reply
#3
How can you make an array in a UDT without it being a string? In other words, it doesn't allow me to do something like: Actor(3) AS Ent_Actor.

Regarding inheritance, I understand the point that it's not in the spirit of QBasic.

Regarding a NaN value, it's mostly for things like geometry; here's an example that happened to me: to detect if two lines are parallel, I have to take the vector of the line and then divide its y by its x. But if it's a horizontal line, it will be a division by zero.
Reply
#4
(09-19-2025, 05:24 PM)SkaZZ Wrote: How can you make an array in a UDT without it being a string? In other words, it doesn't allow me to do something like: Actor(3) AS Ent_Actor.

Regarding inheritance, I understand the point that it's not in the spirit of QBasic.

Regarding a NaN value, it's mostly for things like geometry; here's an example that happened to me: to detect if two lines are parallel, I have to take the vector of the line and then divide its y by its x. But if it's a horizontal line, it will be a division by zero.
I'm sure you can handle the Geometry case with ON ERROR GOTO to catch the division error.    More than one way to skin a cat.

I'm still a bit fuzzy on what you want for UDT's.      I'm thinking you want to put an Array in a UDT.    
You are correct there That isn't supported.           An ARRAY OF a UDT is allowed.    

Take a look at the _MEM functions/sub's   They pretty much implement a BASIC Pointer type.    I believe you 
could but a  Type _MEM in a User Defined Type.      Then later allocate Memory for that pointer and treat it as an array.   
The code will be a little different than what your thinking but you should be able to accomplish much the same tasks !.

Now writing a _MEM variable to a file is probably pretty useless.    It's only going to hold valid information at run time as it is essentially a memory pointer !
In that case a fixed length string is really the way to go.      (Side Note:   You could also use _MEMGET & _MEMPUT to copy that fixed string data to an 
actual array at another point in your code !

DIM MYSTRING AS STRING * 1024

OPEN "MYFILE.DAT" FOR BINARY AS #1

GET #1,,MYSTRING

DIM MYLONG(0 TO 255) AS _UNSIGNED LONG
DIM MYBUFFER AS _MEM

MYBUFFER = _MEMNEW(1024)

REM COPY THE STRING TO THE LONG ARRAY !

_MEMPUT MYBUFFER, MYBUFFER.OFFSET, MYSTRING

_MEMGET MYBUFFER, MYBUFFER.OFFSET, MYLONG()
Reply
#5
I apologize, I think I explained myself poorly. I don't need to capture that division as an error; sometimes it's necessary for that value to be NaN. For example, for the intercept point (2D) of a line, its x or y coordinate can be NaN (undefined), and that would be correct.
My current solution is:

Code: (Select All)
FUNCTION Math_IsValueNaN%% (value!)
    Math_IsValueNaN%% = INSTR(STR$(value!), "INF") > 0
END FUNCTION
The array in UDTs is to make it more natural, because in the end I can also use routines to convert from string to array of the structure I want and vice versa as serialization methods.
Reply
#6
For the IDE colors, that's simple -- count the numbers of colors in use.  Then see how many colors there are in SCREEN 0 in total.  With such a limited palette, some things have to share the crayons.
Reply
#7
And maybe look here for Nan and Inf: https://qb64phoenix.com/forum/showthread.php?tid=1984
Reply
#8
Sorry, I didn't know about text mode (SCREEN 0) and hadn't thought of C++.
Thanks for the replies.
Reply
#9
(09-19-2025, 06:05 PM)SkaZZ Wrote: I apologize, I think I explained myself poorly. I don't need to capture that division as an error; sometimes it's necessary for that value to be NaN. For example, for the intercept point (2D) of a line, its x or y coordinate can be NaN (undefined), and that would be correct.
My current solution is:

Code: (Select All)
FUNCTION Math_IsValueNaN%% (value!)
    Math_IsValueNaN%% = INSTR(STR$(value!), "INF") > 0
END FUNCTION
The array in UDTs is to make it more natural, because in the end I can also use routines to convert from string to array of the structure I want and vice versa as serialization methods.

   The _memput _memget copy method is probably a lot faster than any element by element conversion method you would write.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)