Skip to content

Do we want typedef support? #32

@bclothier

Description

@bclothier

Because I do lot of API declares, I've sometime wished that VB* would allow me to create typedefs -- having LongPtr represent HWND, HDC, and so forth can get quite tedious and make it possible to accidentally mix wrong kind of data that are otherwise compatible. If we allowed for capability to create a typedef statement, that would enable the compiler to provide a warning when a suspicious cast from one LongPtr to another LongPtr is going to be performed, which would go long way toward eliminating this class of programming errors. We can then specify explicit cast where it is appropriate which requires language support for this new class of type casting.

However, I'm on the fence over this one - the typedef statement is very Cish and not very BASICish. We have UDT but single-member UDT is quite awkward to use. This would be not very useful in a codebase that doesn't deal with API as much and thus would potentially be just a feature bloat.

It's also possible there are better way to solve this problem that doesn't involve adding even more lines of declarations to define the data types before the Declares.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions