View Full Version : OOP sample
DirectuX
28-10-2019, 10:54
Maybe related to my other posts about udt and oop ,
while studying the oop samples, I found that thinBasic\SampleScripts\OOP\VariadicArrayAndType.tbasic sample has an error code 102 "Expected equal sign for UDT full buffer assignment or an UDT element name." at line 23.
but I didn't catch the meaning of the description.
Uses "Console"
Type SubType
data As String
Function _Create(ByVal data As String)
Me.data = data
PrintL "Subtype created" In 12
End Function
Function _Destroy()
Me.data = ""
PrintL "Subtype destroyed" In 12
End Function
End Type
Type Base
s As SubType
Function _Create(ByVal data As String)
PrintL "Base created" In 10
Me.s._Create(data)
End Function
Function _Destroy()
Me.s._Destroy
PrintL "Base destroyed" In 10
End Function
End Type
PrintL f((116, 104, 105, 110, 66, 97, 115, 105, 99)) In 11
WaitKey
Function f( x(Any) As Byte) As String
Dim b As Base(Memory_Get(VarPtr(x(1)), UBound(x)))
Function = b.s.data
b._Destroy
PrintL "should print empty quotes now" & $DQ & b.s.data & $DQ In 8
PrintL
PrintL "result as follows:"
End Function
Petr Schreiber
01-11-2019, 20:00
Hi Primo,
thanks a lot for reporting it. I think some recent change in parsing does not allow to call underscored methods.
Definitely worth further investigation, with fix or adjusted example as a result.
Petr
Yes I think it does appear to be a problem with underscored methods. I recently got a new computer and wanted to try out the OpenGL reporting tool from this (https://www.thinbasic.com/community/showthread.php?7848-TBGL-troubleshooting) thread and got the same error. I'm using the newest version of thinBasic v1.11.2.0.
Petr Schreiber
01-01-2020, 09:50
Hi Matthew,
I fixed the issue with the OpenGL report tool (https://www.thinbasic.com/community/showthread.php?7848-TBGL-troubleshooting&p=57991&viewfull=1#post57991), please re-download.
As thinBASIC introduced underscore methods as system ones (destructor/constructor - _create, _destroy), I think it would be wise to reserve them really to thinBASIC and not use them in normal code to avoid further collisions in the future.
Petr
Thanks Petr, it works fine now. I've uploaded the report here (http://bmatthew1.altervista.org/thinbasic/tbgl.report.asus.laptop.txt) if anyone's interested. The new computer isn't anything special, just a cheap laptop but I'm quite surprised at what it can do.
Petr Schreiber
01-01-2020, 15:13
Intel does a great job on feature support & technical papers in the last years, in my opinion. Congratulations on new PC - I wish you many pleasant projects :)
GL_ARB_DIRECT_STATE_ACCESS is the extension I would like to play more this year - and your GPU supports it :)
Petr
DirectuX
02-01-2020, 17:46
GL_ARB_DIRECT_STATE_ACCESS is the extension I would like to play more this year - and your GPU supports it :)
GL_ARB_direct_state_access
In unextended OpenGL, most mutation of state contained in objects is through
an indirection known as a binding. Objects are attached to a context (either
directly or indirectly via a container) and then commands to modify or
query their state are issued on that context, indirecting through its
attachments and into the underlying object. This is known as `bind-to-edit'.
This extension derives from the GL_EXT_direct_state_access extension, which
added accessors for most state on most objects, allowing it to be queried
and modified without the object needing to be bound to a context. In cases
where a single property of an object is to be modified, directly accessing
its state can be more efficient than binding the object to the context and
then indirecting through it. Further, directly accessing the state of
objects through their names rather than by bind-to-edit does not disturb
the bindings of the current context, which is useful for tools, middleware
and other applications that are unaware of the outer state but it can also
avoid cases of redundant state changes. (...) (https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_direct_state_access.txt)
Petr Schreiber
02-01-2020, 20:28
Unlimited p.o.w.e.r - I have seen demos where it brought really crazy performance benefits.
Petr
DirectuX
10-01-2020, 13:13
Unlimited p.o.w.e.r
Petr, we all know where that gets ...
https://www.youtube.com/watch?v=Sg14jNbBb-8
Petr Schreiber
11-01-2020, 17:43
https://www.youtube.com/watch?v=jIHF8Xe-O6Y
...but the performance benefits are worth it.
Petr