Changeset da81e1d


Ignore:
Timestamp:
Nov 18, 2016, 1:47:00 PM (5 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
ba5131d
Parents:
5a0735a
Message:

Added notes on vtable binding and bikeshedding to virtual proposal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/proposals/virtual.txt

    r5a0735a rda81e1d  
    106106would have many ambiguities if it did support multiple virtual parameter.
    107107
     108It is worth noting that the function pointers in these vtables are bound at object construction, rather than
     109function call-site, as in Cforall's existing polymorphic functions. As such, it is possible that two objects
     110with the same static type would have a different vtable (consider what happens if draw(line*) is overridden
     111between the definitions of two line objects). Given that the virtual drawable* erases static types though,
     112this should not be confusing in practice. A more distressing possibility is that of creating an object that
     113outlives the scope of one of the functions in its vtable. This is certainly a possible bug, but it is of a
     114type that C programmers are familiar with, and should be able to avoid by the usual methods.
     115
    108116Extensibility.
    109117
     
    145153
    146154These behave exactly as the previous example but all the forwarding routines are automatically generated.
     155
     156Bikeshedding.
     157
     158It may be desirable to add fewer new keywords than discussed in this proposal; it is possible that "virtual"
     159could replace both "vtable" and "vptr" above with unambiguous contextual meaning. However, for purposes of
     160clarity in the design discussion it is beneficial to keep the keywords for separate concepts distinct.
     161
Note: See TracChangeset for help on using the changeset viewer.