Skip to content
Pedro Pinto edited this page Sep 4, 2016 · 16 revisions

#TODO

  • MonomorphicBinder for builtins:
    1.to_s
    ["a#@b"].inspect
  • Configurations:
  • Compiler's default CallSiteBinder implementation.
  • PolymorphicSiteBinder maximum cache size threshold.

#Notes

  • alias and alias_method create a copy of the method, instead of using the original.
  • Example of Regexp with '\n' delimiter and line jump: eval("%r\n\#{<<EOS}\na\nEOS\ni")

#Parameters

call (sender):
    ruby : <expr>                   # Required
           <label>: <expr>          # KeyRequired
           <expr> => <expr>         # KeyRequired
           *<expr>                  # Rest
           **<expr>                 # KeyRest
           &<expr>                  # Block

def (receiver):
    C# :   <type> <name>           // Required/KeyRequired
           <type> <name> = <value> // Optional/KeyOptional
           params <type>[] <name>  // Rest
           <delegate> <name>       // Block (last argument or immediately before params)

    ruby : <name>                   # Required
           <name> = <expr>          # Optional
           <label>:                 # KeyRequired
           <label>: <expr>          # KeyOptional
           *<name>                  # Rest
           **<name>                 # KeyRest
           &<name>                  # Block
           (<name> {, <name>}+)     # Parallel

C# Definition (prototype)

iObject Method(
                 iObject       req,
                 iObject       opt = null,    // [Optional]
    [Key]        iObject       keyreq,        // [Key]
    [Key]        iObject       keyopt = null, // [Key] + [Optional]
    [Key]        Hash          keyrest,       // [Key] + Hash
                 Func<iObject> block,         // Delegate, last parameter or before [ParamArray]
          params iObject[]     rest           // [ParamArray]
)

KeyOpt call arguments

Example: f(a: 1)

They are passed as a 2 element array, since the CallSite knows that that parameter is a KeyOpt.

So, it is transformed into: site<'f'>.Call(new Array() { new Symbol("a"), new Fixnum(1) })

Equality

==       =>   iObject#Equals(iObject) (by default equal?)
equal?   =>   object::ReferenceEquals(object, object)
eql?     =>   (iObject i, iObject a) => i.hash == a.hash

Clone this wiki locally