Announcement

Collapse
No announcement yet.

Please add Structures

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Please add Structures

    You ALMOST have a language that can be somewhat Object Oriented.
    All it really needs now is the ability to define a C-like struct, and be able to use it to reference a block of memory returned by mem_alloc().
    struct mystruct {
    var id;
    var x;
    var y;
    var w;
    var h;
    var stuff[10];
    }

    var stuff as mystruct; (or some similar syntax)
    stuff := mem_alloc( sizeof( mystruct));
    stuff.id := 3;

    etc...

  • #2


    Yes its on the cards, the curley braces were always destined for structure templates in 4DGL but its still a work in progress. The dot operator will behave as expected for structures, but currently only works with private function variables - syntax will be similar.
    Regards,
    Dave

    Comment


    • #3


      Hi - is there any update on when this might be implemented?

      Thanks

      Comment


      • #4


        Should be available late Q2 to mid Q3.
        Regards,
        Dave

        Comment


        • #5


          any update on structures? is it available yet?

          Thanks,
          Colin

          Comment


          • #6


            No, sorry.
            Mark

            Comment


            • #7


              Hi,

              Please add structures concept in 4DGL, I need them urgently.

              Comment


              • #8


                It's on our list of things to do, but it wont be happening in what I suspect your 'need them urgently' timeframe is.

                Since all datatypes are essentially words why can't you treat an array of words as a 'structure'? Each element would be defined as a constant and there you have it, a poor man's structure.
                Mark

                Comment


                • #9


                  There is some example code here that may help :-


                  http://4d.websitetoolbox.com/post?id=5914711
                  Regards,
                  Dave

                  Comment

                  Working...
                  X