Redim entries - optimising code / ArraySlice

Didn’t read the feedbacks, sorry, no feedback app in this machine. The generics syntax you wrote is kind of C-ish, for Basic language derivatives, there is another known, more popular way, using the keyword “Of”. Since 2005 AFAIK. I would follow that trend.

[code]Class MyCollection(Of ElementType)
Sub Add(Byval key As String, Byval Element As ElementType)
'Note that the type parameter ElementType is being used inside
'the generic type just like any other type

Dim Element2 As ElementType

End Sub

End Class

Dim IntegerCol As New MyCollection(Of Integer)
Dim DateCol As New MyCollection(Of Date)[/code]

I’m not to hung up about the actual syntax they use
I picked the <> delimiters as they are currently unused in a declaration and delimiting the TYPE with makes it pretty obvious where that type is in whatever generic code gets created
Moving to the VB/Net style syntax would be a much bigger grammar change I suspect which would make it less likely to happen

The prefix token “Of” is also unused. Xojo made choices borrowing much of its syntax from BASIC, never adopted the desired += or -= operators alleging that ( “too C/C++/C#/Java” ) , makes no sense escaping the “let’s keep it familiar to the user base from other BASIC alike languages” right now. Using the C/C++/C#/Java template metaprogramming syntax right now makes much less sense than accepting += and -=, that ARE already present in current BASIC derivatives. I miss talking to Joe on those subjects, would like to hear his opinion.

Of is a language keyword already

dim of as integer

will get you a compiler syntax error
I have no idea IF this is why it was reserved or not

I suggested the <> style as its easy to find that in code.
Much easier than finding T in the examples on the page you cited as far as I’m concerned
Or swap the <> for some other pair unused in a decl - could use {}, []
Being able to quickly find that type decl is all I’m suggesting
I also expect the “Of style” would require more changes to the compiler than the <> suggestion but thats only based on more than a decade perusing the IDE, the compiler grammar etc so …

The rest of the operators I;m fine with them never adopting them

[quote=454134:@Norman Palardy]will get you a compiler syntax error
I have no idea IF this is why it was reserved or not[/quote]

Yes, it is, possibly for the future use of generics.

Possibly - I’d have to ask Mars, Joe or Aaron since it would have been one of them that added that
WITH is also reserved as far as I recall and also will not compile if you do

dim with as integer

dunno what others there might be

“With” is used for shortening repetitive references, like:

[code] Dim theCompany As New BusinessInfo

With theCompany
.Name = “Xojo”
.Website = “
.SalesEmail = “
End With[/code]

They might be used in VB.Net and VB6 even but that doesnt mean they will be used in Xojo in an equivalent fashion
OF and WITH are just reserved words in Xojo right now
They arent used for anything

Xojo isnt VB nor should it be

Well, but that’s the usual behavior of those keywords, in special “with”, like it or not. Including many non-basic derivatives. So this hints a reservation for future use.

If you mean “thats normal meaning for MS languages” maybe - but thats hardly consistent even in MS tools or across many languages. And MS languages hardly makes it a cross section of all languages

OF is reserved in delphi but unused
WITH is reserved in delphi and used for a completely unrelated purpose to VB / VB.Nets use of WITH
Java reserves neither
javascript did reserve WITH but it is deprecated and discouraged - and used in a way that wasnt quite the same as VB
go reserves neither
ruby reserves neither

the uses of OF and WITH you seems to be citing are peculiar to MS tools

EDIT : this is a better list

EDIT 2:the upshit is SOMETHING for generics, I really dont care what, since it would be immensely useful
That I proposed something different than you did is really immaterial

And thats my last post on this silly debate about <> vs OF or WITH

You made it silly, your choice. And I do program Object Pascal (Delphi) too, so…

“Of” IS used everywhere. Not exactly for Generics, but in type associations and sets with a bit of metaprogramming as:

type MyMetaClass = class of class_type;

“With” have the SAME use as in BASIC derivatives, but different syntax as in:

With theCompany Do Begin Name = "Xojo"; // same as theCompany.Name Website = ""; SalesEmail = ""; End;

Python also uses “with” as a temp shorthand for objects:

with open("x.txt") as f: #// f receives the reference to the object line1 = f.readline() line2 = f.readline() #// f is discarded, was just used as a temporary shorthand to the object

Again… I would prefer discuss language design with the language designers. Of and With are not reserved without intentions.