You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interesting idea, but seems oddly specific in current proposal. I would probably use those keywords to generate valid little-endian values without resorting to hex sequences, e.g. DWORD(0) would produce 00 00 00 00, DWORD(1) would produce (01 00 00 00), FLOAT(1.0) would produce (00 00 80 3F).
In theory, there could be some syntax to create higher-level structs out of basic primitives, to define, e.g. Vec3 as a combo of three floats, and then VEC3(0.0, 1.0, 0.0) would produce 00 00 00 00 00 00 80 3F 00 00 00 00
Adding lots of custom keywords just to substitute 00(size_of_struct) might be unreasonable
This is generally good idea.
Biggest shortcoming of the hex blocks is lack of simple way to put integer types there.
There is & prefix but it results in bytes count dependent on the provided value. Which makes it useless when defining any kind of structures.
Staying with current hex conventions declaring of two byte number with value of 6 could look like this: &(2)6
However it is far from intuitive notation.
Names WORD, DWORD are bit problematic as these are not used in current syntax at all.
I propose types: int, int8, int16
How to use them in context I have no idea. int(12) will look confusing next to declaration of byte 0 repeated 12 times: 00(12)
Maybe (12: int) then?
hex
(1: int16) (2: int16) (3: int16)
end
This kind of notation also asks for support of other types SB handles, like ShortString and String \ LongString.
Floats support seems no-brainer as already mentioned:
The idea stems from a question
"How can buffers that will be used as arrays be created more clearly?"
This is because you cannot include calculations that the compiler will solve, so that it can solve byte structures.
I thought about the syntax "structure(amount)", Because when compiling it, it doesn't matter how hundreds of "00"s are ordered, they are all "00"s.
The size of the hexadecimal blocks does not change. The displacements we make to each region are the same.It only changes the way we declare the blocks.
hex
Vec3() // It's easier to read.
0.0 0.0 0.0 // That's understandable...
00(12) // It's disgusting.
00 00 00 00 00 00 00 00 00 00 00 00 // It's worst thing in the world
end
This creeps into style of regular variables declaration. Then why not add field names:
hex MyStruct
(status: int = false) // 00 00 00 00
(position: float[3] = 0.0) // 3 x 0.0
(name: longString = "empty") // 16 characters unterminated string
end
There was already idea for sizeof directive. Similar offsetof could be used then to get named fields from named hex blocks.
Uh and that's how we got into structs for SB.
Let's be reliable. There is ton of simpler features already stuck in long queue.
I would not put high hopes into seeing anything beside support of immediate floats in hex blocks.
Activity
x87 commentedon Dec 12, 2025
Interesting idea, but seems oddly specific in current proposal. I would probably use those keywords to generate valid little-endian values without resorting to hex sequences, e.g.
DWORD(0)would produce00 00 00 00,DWORD(1)would produce (01 00 00 00),FLOAT(1.0)would produce (00 00 80 3F).In theory, there could be some syntax to create higher-level structs out of basic primitives, to define, e.g. Vec3 as a combo of three floats, and then
VEC3(0.0, 1.0, 0.0)would produce00 00 00 00 00 00 80 3F 00 00 00 00Adding lots of custom keywords just to substitute
00(size_of_struct)might be unreasonableMatiDragon-YT commentedon Dec 14, 2025
You can now write FLOAT and STRING in hexadecimal blocks, or so the Sanny Builder documentation shows.
There is no greater or lesser impact than continuing to write in the traditional way.
x87 commentedon Dec 14, 2025
Strings yes, floats no
MatiDragon-YT commentedon Dec 20, 2025
And why not support it? And also allow the keywords above :)
MiranDMC commentedon Dec 20, 2025
This is generally good idea.
Biggest shortcoming of the hex blocks is lack of simple way to put integer types there.
There is
&prefix but it results in bytes count dependent on the provided value. Which makes it useless when defining any kind of structures.Staying with current hex conventions declaring of two byte number with value of 6 could look like this:
&(2)6However it is far from intuitive notation.
Names WORD, DWORD are bit problematic as these are not used in current syntax at all.
I propose types: int, int8, int16
How to use them in context I have no idea.
int(12)will look confusing next to declaration of byte 0 repeated 12 times:00(12)Maybe
(12: int)then?This kind of notation also asks for support of other types SB handles, like ShortString and String \ LongString.
Floats support seems no-brainer as already mentioned:
MatiDragon-YT commentedon Dec 20, 2025
The idea stems from a question
"How can buffers that will be used as arrays be created more clearly?"
I thought about the syntax "structure(amount)", Because when compiling it, it doesn't matter how hundreds of "00"s are ordered, they are all "00"s.
The size of the hexadecimal blocks does not change. The displacements we make to each region are the same.It only changes the way we declare the blocks.
MiranDMC commentedon Dec 20, 2025
?
MiranDMC commentedon Dec 20, 2025
This creeps into style of regular variables declaration. Then why not add field names:
There was already idea for sizeof directive. Similar offsetof could be used then to get named fields from named hex blocks.
Uh and that's how we got into structs for SB.
Let's be reliable. There is ton of simpler features already stuck in long queue.
I would not put high hopes into seeing anything beside support of immediate floats in hex blocks.