[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.
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
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
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
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 2:the ■■■■■■ 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 = "xojo.com";
SalesEmail = "hello@xojo.com";
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.