Does anyone need operator overloading ?

Started by Charles Pegge, July 21, 2022, 12:20:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Charles Pegge

If you have not heard of operator-overloading then the answer is definitely no.

Perhaps the only example (well understood by BASIC programmers) is the use of '+' or '&' for combining strings.

However, the general case for operator-overloading on UDTs is dubious and creates complexity in the compiler which I am eager to remove!

Procedures and macros provide ample flexibility in the language without bending operator semantics. But I am prepared to be convinced otherwise.

Ed Davis

Quote from: Charles Pegge on July 21, 2022, 12:20:48 PM
However, the general case for operator-overloading on UDTs is dubious and creates complexity in the compiler which I am eager to remove!

Having programmed in C++:  They are neat for the stuff I write, or that I am quite familiar with.  Not so great when it is totally new (to me) code, and/or they have been abused. 
It does make complex and bignum code much easier to follow, but I don't think it is worth the price.  I'd vote no.

Quote
Procedures and macros provide ample flexibility in the language without bending operator semantics. But I am prepared to be convinced otherwise.

I agree.
  •  

Zlatko Vid

#2
i don't need it
  •  

James C. Fuller


I will voice my opinion as a NO vote.
James
  •  

Chris Chancellor


I don't know much about overloading, but if it is too hard for the compiler to do,  it is better to be a NO
  •  

Nicola

Hi,
I also don't know this very well, but I trust a lot of the knowledge of Charles and others. Therefore, I am also for the NO.

Charles Pegge

I have found that this feature only takes up about 2% of the compiler but is in many pieces, and is quite hard to remove. So I will leave it in place for now.

Thanks for your feedback :)

Theo Gottwald

#7
If you are done with the Linker, take a look on advanced Datatypes.
This is the way to make programming easier and faster (yet you do the work) :-)
For example those from Stan Durham are very efficient.
They beat the PB-Stack and Que Objects by far.
I think of a Variable that I can give two elements, for example a Numeric and a string datattype.
Then i can sort by the number or by the string. But the Pairs stay together.
Multi-Dimensional constructions of Variables in high speed is a feature that most other languages
do not yet have because they most often use Databases for this.
Which is not the fastest way.
Currently you can make multideminensional Arrays, in all languages - but only with one Datatype for the whole Array.
If you want to make an Array with different Datataypes your Options are much more limited.
This is where Improvement is possible.
The others do not do it because its difficult.

Examples.
Dim A(1 to 99 as LONG,STRING) ' Make a Array with connected Pairs of a Number and a String
' This can be improved to a Table.
Dim A(1 to 99 as LONG,STRING,STRING,Byte,LONG,STRING)
Now we have 99 Rows and several Columns (Excel-like).

Modifying the Code from Stan Durham (see above) i think it should be possible.

Charles Pegge


You can create arrays using UDTs. Static arrays are 100% machine efficient, and the various members are accessed simply by adjusting the address offset, which is hard-coded. In this example all the members would be 4 bytes apart in 32bit mode.


type CadPoint
  string lbl
  string typ
  float x,y,z
end type
dim CadPoint p[100]
...