Jump to content

Some missing feature in the script


photo

Recommended Posts

Hi, I have some request about missing possibility in the script,

May be is not possible to do this, it's just a suggestion.

1) Constructor with different type of parameter but the same number of parameter like

 

class FOO {

 

       STS sts;

    

       FOO( string str) {

          sts = new STS(str);

      }

 

      FOO( STS obj) {

         sts = obj.clone();

      }

};

 

For the moment we add in the constructor an other foo parameter for the second constructor.

 

2) structure type and typedef, sometime is not really necessary to have an object just a structure like

 

struct element {

   int a;

   int b;

   int c;

};

 

For the moment in script we are just making class.

 

 

Link to comment

1) UNIGINE script is untyped, so the script engine cannot distingush between same single-argument constructors. But I think it should be possible to have a constructor FOO( int value ) and within the constructor test for the actual type of value and act accordingly.

 

2) I don't think it's a good idea to copy all C++ language constructs as this increases language complexity. That was one reason why Java - designed based on bad C++ experiences - also dropped these constructs.  

Link to comment

Hi Ulf,

 

1) Yep true, about untyped script, i will try your proposal about pass int value and test the type of the parameter.

 

2) About struct, I understand the problem to increase script complexity, and how i say i use class, but I recently write a parser for pln file and i have so many little class, it's for that I talk about struct.

Anyway, thanks, for your response, interesting as always :)

Tony

Link to comment
×
×
  • Create New...