New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generics optimization #193
Labels
Milestone
Comments
Closed
Closed
thekid
added a commit
to xp-framework/xp-framework
that referenced
this issue
Oct 28, 2012
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/remote
that referenced
this issue
Nov 10, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/doclet
that referenced
this issue
Nov 10, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/zip
that referenced
this issue
Nov 10, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/rdbms
that referenced
this issue
Nov 11, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/csv
that referenced
this issue
Nov 11, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/parser
that referenced
this issue
Nov 11, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/rest
that referenced
this issue
Nov 11, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/scriptlet
that referenced
this issue
Nov 11, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/imaging
that referenced
this issue
Nov 12, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/ftp
that referenced
this issue
Nov 12, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/http
that referenced
this issue
Nov 12, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/ldap
that referenced
this issue
Nov 12, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/mail
that referenced
this issue
Nov 12, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/news
that referenced
this issue
Nov 12, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/irc
that referenced
this issue
Nov 12, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/sieve
that referenced
this issue
Nov 12, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/webdav
that referenced
this issue
Nov 12, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/spelling
that referenced
this issue
Nov 12, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/xml
that referenced
this issue
Nov 12, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
thekid
added a commit
to xp-framework/telephony
that referenced
this issue
Nov 12, 2013
# They yielded a php.stdClass instance instead of the one to be instantiated, # which would result in "Fatal error: Call to undefined method stdClass::X()" # when any method X would be called # See xp-framework/rfc#193
The |
thekid
added a commit
to thekid/core
that referenced
this issue
Aug 13, 2014
Left-over from first generic implementation, see xp-framework/rfc#193, which was dropped around three years ago and removed back in Nov 2013
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Scope of Change
Generics will be optimized.
Rationale
Functionality
Currently, generics are implemented as follows:
It will hold an array of the component types.
the type checks.
generics, populating the __generic member with the given types'
names.
Example (abbreviated):
This has the following downsides:
code for the manual component type verification.
are "instanceof"-compatible
type is string would mean manually accessing its __generic member.
Plan
A generic instance should be created at runtime named with unique name
created of the base and component types. A class has two names, one that
is reported by
XPClass::getName()
(F) and one used literally (L):The same generation process happens for all generic interfaces these
classes implement and the generic base classes they extend.
The middle dot (·, Alt-Gr + "." in Cygwin) is used in the XP Framework
for generated classes and in fully qualified names (see xp-framework/rfc #37). The
cedil sign (¸, Alt-Gr + "´" in Cygwin) is used to separate the components.
Declaration
To declare a generic class using the XP framework, we will resort to
annotations:
In XP language, this needn't be done as it syntactically supports generics:
Instantiation
To instantiate generics, the
create()
core functionality needsto be used. The inner workings are as follows:
What we will end up with is the following:
Reflection
Whether a type is a generic instance should be determinable at runtime:
Reflection on generic definitions should also be possible:
Also, reflective creation of generic types should be possible:
Discovering the definition type:
Type restrictions
The generic types can now be used in parameter type hints, although
somewhat ugly:
Security considerations
n/a
Speed impact
Faster.
Dependencies
xp-framework/rfc #197
Related documents
(applies in xp5_8 branch only)
The text was updated successfully, but these errors were encountered: