VB language extensions wishlist



What features would you like to see in a next version of classic VB,
assuming such a thing would happen? Please restrict yourself to
language features and base libraries (such as e.g. Collection), not
IDE or task-specific libraries (UI, database access etc). A few
examples from my own list follow, in no particular order, but feel
free to add your own. Consider it an extensible request for comments.

- Ability to define interfaces and classes separately.

Interfaces are pretty obvious, .int files which cannot contain
bodies for methods, only signatures allowed. Classes would probably
need some property that allows to disable automatic generation of
interfaces.

- A 64-bit integer data type, and unsigned versions of all integer
types.

"Unsigned" could be a contextual keyword - e.g. "Unsigned = 1" is
handled the same way it is now for compatibility, but "Unsigned Long"
in combination always refers to a type. 64-bit integer - "Long Long"
or "LongLong", or maybe "Integer * 64"?

- Pointers to data and functions (mostly for interop with C APIs, but
also for occasional optimization).

Something like "Dim p As AddressOf Long" and "Dim f As AddressOf
Sub(x As Integer)", and a dereference operator - "ValueAt" or just
plain prefix "@". Existing "AddressOf" operator can be reused as is.

- Weak references (for cyclic data structures).

Not doable for arbitrary COM objects, but can be done for classes
defined in VB. Something like:

Dim x As Collection, y As Collection? ' one strong ref, one weak
ref
Set x = New Collection
Set y = x
Print y Is Nothing ' False
Set x = Nothing ' last strong ref to collection gone, all weak refs
auto-zeroed
Print y Is Nothing ' True

- Syntactic sugar to delegate calls to methods of implemented
interface to a wrapped object.

Implements IFooable Using foo ' all methods of IFooable now
delegate to Me.foo ...
Private foo As IFooable
Sub IFooable_Blah() ' ... except for those explicitly defined
End Sub

- Universally usable Set

That is, Set can be used to assign value to a non-object variable.
This makes it a universal way to say, "Yes, I really want to change
the variable, don't bother with default properties etc, whether there
are any or not":

Dim x As Object, y As Integer
Set x = New Collection
Set y = 123 ' why not?

....
.



Relevant Pages

  • Re: VB language extensions wishlist
    ... If we were dreaming of a brand new, unrestricted evolution of VB6 then there ... Ability to define interfaces and classes separately. ... Something like "Dim p As AddressOf Long" and "Dim f As AddressOf ... ' one strong ref, one weak ...
    (microsoft.public.vb.general.discussion)
  • RE: VB language extensions wishlist
    ... Ability to define interfaces and classes separately. ... Something like "Dim p As AddressOf Long" and "Dim f As AddressOf ... ' one strong ref, one weak ... Syntactic sugar to delegate calls to methods of implemented ...
    (microsoft.public.vb.general.discussion)
  • Re: VB language extensions wishlist
    ... GET command for reading binary files. ... Ability to define interfaces and classes separately. ... Something like "Dim p As AddressOf Long" and "Dim f As AddressOf ... ' one strong ref, one weak ...
    (microsoft.public.vb.general.discussion)
  • Re: VB language extensions wishlist
    ... Ability to define interfaces and classes separately. ... Something like "Dim p As AddressOf Long" and "Dim f As AddressOf ... ' one strong ref, one weak ... Private foo As IFooable ...
    (microsoft.public.vb.general.discussion)