Page 1 of 1

SpiderBasic 3.20 does not enforce AddElement() for structured list assignment, unlike PureBasic

Posted: Tue Sep 15, 2026 10:54 pm
by Webarion
Hello, I found a discrepancy between the PureBasic and SpiderBasic compilers regarding structured dynamic lists. In PureBasic, the following code throws a compiler error because the list element must be explicitly initialized with AddElement() before assignment. However, SpiderBasic compiles it successfully without any warnings, which breaks the "write once, compile anywhere" syntax rule between PB and SB. Reproduce

Code: Select all

Structure MyMap
  List MyList.i()
EndStructure

Define NewMap MyMap.MyMap()

; This line compiles fine in SB, but causes a compiler error in PB:
MyMap("1")\MyList() = 1
Expected behavior: SpiderBasic should throw a compiler error stating that AddElement() is required, or that direct assignment to a structured list is not allowed, matching PureBasic's strict type safety. Best regards.