Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: Signs of life out there!

  1. #11
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,544
    Rep Power
    172
    still thinking about syntax - today I come up with this - no call-keyword:

    [Result =] Like "myType" At pData, "[.]myFunction" ([parameters])
    
    the thought behind:

    Like (without DIM-keyword) could create an absolute temporary variable that immediately gets destroyed again after the codeline was proceeded. The main-problem I have currently is, if using "DIM|LOCAL varname..." it's impossible to change type of varname again.
    If there were only some "pseudo-variable" whithout any name the function containing this call could not "remember" that variable - so no multiple-Dim-Error...
    Last edited by ReneMiner; 16-05-2014 at 10:07.
    I think there are missing some Forum-sections as beta-testing and support

  2. #12
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732
    Hi Rene,

    I love the proposed functionality, but the syntax diverges a bit from BASIC approach, that is, to make the code human readable.

    What about:
    [Result =] Call "[.]functionName" ([params]) Using pData As|Like Type|"Type"
    
    Examples:
    sText = Call ToString() Using pVector As Vector3D
    
    sText = Call ToString() Using pVector Like "Vector3D"
    
    It is more like english sentence, still brief enough to separate the functional blocks by context giving keywords...


    Petr
    Last edited by Petr Schreiber; 17-05-2014 at 10:31.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #13
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,544
    Rep Power
    172
    I thought into that direction too already, but I thought call would only work the "Call ... To Result"-way but not like "Result = Call..." - but if that were possible- I'd be happeeeeh.
    Really I don't care much about the final syntax - it's more about the functionality and as Eros already ascertained not to need some global variables therefore.

    I was hoping there would be some "default-layover" to each and every type created during the type-definition that would be placed on the calling variables position if a type-function ("Method") gets called through a variable of that type and since the call on a pointer would not be a call from a variable, Me is not dimensioned within the method anyway, so there could be some additional Call-Keyword that indeed just sets the Pointer where to find Me which would be the simplest way.
    Call_At pData, "myType" ,|& "[.]myMethod"[([methods_paramaters])] [To Result]
    
    -also syntax were easy, similar/close to Call_IfExists
    Last edited by ReneMiner; 17-05-2014 at 11:21.
    I think there are missing some Forum-sections as beta-testing and support

  4. #14
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,544
    Rep Power
    172
    perhaps syntax like that:

    Type t_example
       X(123) as Byte
       fun as Function 
    End Type
    
    Function t_example.fun() 
    ' whatever
    End Function
    
    Dword pData = Heap_Alloc(SizeOf t_example)
    
    [Result =] ByRef [Like] "t_example" At pData, "[.]fun"()
    
    Last edited by ReneMiner; 20-05-2014 at 08:45.
    I think there are missing some Forum-sections as beta-testing and support

  5. #15
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732
    It would be ideal to have thinBasic SDK function allowing to do this, the syntax for ThinBASIC language itself could be arranged later and customized by module creators.

    Something like:
    thinBasic_GetTypeHandle( ByVal sType As String ) As Dword ' -- For decoding type from string
    
    thinBasic_GetFunctionHandle( ByVal sFunction As String ) As Dword ' -- For decoding function from string
    
    TYPE thinBasic_Param
      valuePassingType As Long ' -- Byval/Byref
      valueType As Long ' -- TypeOf thing, returned by thinBasic_GetTypeHandle
      valuePointer As DWord ' -- Pointer to actual data
    END TYPE
    thinBasic_FunctionCallUDT ( ByRef variable As Any, functionHandle As DWord, params() As thinBasic_Param ) As DWord ' -- Allows using UDT variable directly or via ByVal pointer override, params passed as array of them. Returns pointer to return value
    

    Petr
    Last edited by Petr Schreiber; 20-05-2014 at 21:43.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #16
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,544
    Rep Power
    172
    You already seem to have some usage for this in mind and I think it would be another big step to dynamic different subtypes which is probably a very rare feature - most basic dialects i know allow either fixed size subtypes only, some not even dynamic subarrays and I don't know a single programming language that would allow individually different subtypes to elements of the same maintype without having to code the memory-management by oneself.

    All this could be done easily if we had this feature (best would be together with the Item-Type & some EnumType-Function built-in- I hope you remember*) and I pray to the Lords of Basic that Eros will find the time to implement this and also to fix bundle-utility asap, so we have an applicable tB-version this summer available.

    *Item-Type: enables to append 1-dimensional arrays or single elements of any type to anything that can store 2 Dwords|1 Quad. Attached Unit contains the basic functions only.
    I think it's about time that thinCore itself gets its first functional types built-in anyway
    Attached Files Attached Files
    Last edited by ReneMiner; 21-05-2014 at 10:04.
    I think there are missing some Forum-sections as beta-testing and support

  7. #17
    I pray to the Lords of Basic that Eros will find the time to implement this
    It seems Eros has been pretty busy with real life and thinBasic isn't on a fast-trac with it's ongoing development. Maybe it's time for Eros to open the development door to a few developers like yourself, Petr and Charles. As I understand it thinBasic is a labor of love and therefore I see no reason not to spread the joy to others committed to making thinBasic a great BASIC language.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  8. #18
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732
    Rene,

    nothing worse than false hope, but during my way home from work I got an idea for hack.
    I will try it during weekend - if I forget, feel free to remind me I have a homework to do!


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  9. #19
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,544
    Rep Power
    172
    Hack? Nosy... what kind of? Is it to poke the pointer into some "constant" variable to kind of "protect" the global?
    I think there are missing some Forum-sections as beta-testing and support

  10. #20
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732
    Hi Rene,

    I thought I will manage to implement the functionality for you, but I succeeded only partially.

    If you download attachement, you will be able to do this:
    Uses "MeHack"
    
    ' ---
    Type MyType
      a As Single
      b As Long
      func As Function
    End Type  
    
    Function MyType.func()
      
      Dim data As MyType At IIf(VARIABLE_Exists(Me), VarPtr(Me), CBHNDL)
      
      MsgBox 0, "MyData:" + $CRLF + data.a + $CRLF + data.b
      
    End Function   
    
    ' ---
    Dim data As MyType
    data.a = 1.2
    data.b = 3                 
    
    DWord dataPtr = VarPtr(data)
    
    MeHack_CallFunction(dataPtr, "MyType.func")
    
    So I basically force CBHNDL to hold data pointer for ya

    The package includes:
    • module source code for PB10
    • compiled module
    • test script


    I think I would be able to hack together function allowing to do this + pass parameters somehow. Sadly the function allowing to pass parameters doesn't allow to pass CBHNDL as of now, so it is not possible to do.

    To achieve your requirement, it would be needed to expand thinBasic_FunctionCall_ByPtr from SDK with pointer to ME. That should do the trick.


    Petr
    Attached Files Attached Files
    Last edited by Petr Schreiber; 24-05-2014 at 11:13.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Life 3D alfa
    By RobbeK in forum TBGL General
    Replies: 10
    Last Post: 09-11-2013, 00:22
  2. Signs that you're a bad programmer
    By ErosOlmi in forum Development
    Replies: 5
    Last Post: 04-11-2011, 17:47
  3. Second Life
    By Charles Pegge in forum Shout Box Area
    Replies: 11
    Last Post: 15-02-2011, 00:31
  4. my life with c++
    By kryton9 in forum C / C++
    Replies: 4
    Last Post: 13-06-2010, 05:00
  5. Journey of Life
    By Charles Pegge in forum Shout Box Area
    Replies: 1
    Last Post: 27-03-2010, 00:56

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •