Functionally Equivalent Language Translation →
(new Classname arg1 arg2 ... argN) ; create instance of Classname (new var-name arg1 arg2 ... argN) ; create instance of String value of var-name (new StreamWrapper "http://feltweb.info") (defvar dyn-class "StreamWrapper") (new dyn-class "http://feltweb.info" 8192)
See also DEFCLASS MVAR CVAR CONST THIS MY MCALL / -> CLASS-CALL / ::
FELT allows "object oriented" development by way of the NEW
instruction. Use a constant Classname or a variable name containing a string value at run-time. All other arguments are passed through to the constructor. A new instance is returned.
The NEW
instruction is how FELT lets you write programs that need to use the object-oriented (OO) paradigm. The instruction takes the first argument as being either a literal classname if it starts with an Uppercase Letter otherwise it assumes it to be the name of the variable. This is not ideal but it is the simplest way and most programming conventions adhere to this; camel-case class names are everywhere and FELT has had to rely upon this.
Translating the example code into PHP we get this:
new StreamWrapper("http://feltweb.info", 8192); $dyn_class = "StreamWrapper"; new $dyn_class("http://feltweb.info", 8192);
In the first instantiation we see the normal usage of the PHP new
function and in the second we can see that the value of the $dyn_class
variable has been used to indirectly