Project Panda

New programming language with the slated goals:

  • Multiple typing methods
    • Dynamic typing ("any")
    • Implicit Static typing ("auto" or type elided)
    • Explicit Static typing ("<given typename>")
def function():any    { ... } -> returns anything
def function()        { ... } -> returns one [nonoptional] type
def function():auto   { ... } -> returns one [nonoptional] type
def function():nil    { ... } -> returns nothing
def function():auto   { if ( ... ) return "string"; else return 3.14; }
    -> error (ambiguous return type)
def function():any    { if ( ... ) return "string"; else return 3.14; }
    -> okay (dynamic return type)
def function():string { if ( ... ) return "string"; else return 3.14; }
    -> error (invalid return type)

def function() { ... } -> no arguments
def function( *args ) { ... } -> 0+ arguments
def function( *args[1:] ) { ... } -> 1+ arguments
def function( first , *args ) { ... } -> 1+ arguments
def function( **etc ) { ... } -> 0+ named arguments
def function( arg1 , arg2 , arg3 ) { ... } 3 arguments

def function( arg1 : any , arg2 : auto , arg3 : string , arg4 )
    -> arg1 can accept dynamic types
    -> arg2 expects to be able to statically verify the usability of
       the given type in the function
    -> arg3 expects only string or string derivatives.
    -> arg4 is auto by default
    -> return type is auto by default
  • Built in refactoring specification
    • Tools and built in revisioning
    • "Reserved" names/keywords for certain pattern refactorings.
Taking a singleton instance and refactoring to use dependancy injection:

def patch_mylib1_to_mylib2() {
    refactored_class = application.modules[ :MyLib ].classes[ :MySingleton ]
    refactored_class.refactor( "MyManager" ) # Should replace all call names too
    calls = refactored_class.singleton_method[ :GetInstance ].calls
    calls.each { | call |
        call.function.class.eval "attribute :__my_manager :MyManager"
        call.refactor "@__my_manager" # Replaces call 'MySingleton::MyManager::GetInstance' with '@__my_manager'
    }
    calls.each { | call |
        if ( call.function.class.base.has_method? :__my_manager ) {
            call.function.class.remove_method( :__my_manager ) # factor out redundants
        }
        .......
  • Egocentric language
    • Shouldn't have to switch to another language to spec out bindings — should be able to access own internals directly instead.
    • Should be able to hoist such a mechanism to translate the above to allow extension mechanisms — e.g. parsing C headers similar to ruby's python module loader.
  • Everything's an object/class (no "intrinsics")
  • Everything's (by default) frozen/imutable.