comparison nworker.rhope @ 43:709df3e82bb4

Added methods to support type inference
author Mike Pavone <pavone@retrodev.com>
date Thu, 15 Oct 2009 21:32:43 -0400
parents aabda74c7a88
children a7c79ac22efc
comparison
equal deleted inserted replaced
42:aabda74c7a88 43:709df3e82bb4
749 Add Method@NBlueprint[bp,name:out] 749 Add Method@NBlueprint[bp,name:out]
750 { 750 {
751 out <- [bp]Methods <<[ [[bp]Methods >>]Set[name, Yes] ] 751 out <- [bp]Methods <<[ [[bp]Methods >>]Set[name, Yes] ]
752 } 752 }
753 753
754 Understands Method@NBlueprint[bp,name:out]
755 {
756 out <- [[bp]Methods >>]Index[name] {}
757 { out <- No }
758 }
759
760 Get Field Type@NBlueprint[bp,name:out,notfound]
761 {
762 ,notfound <- [[bp]Fields >>]Index[name]
763 { out <- [~]Index[1] }
764 }
765
754 _Compile Blueprint Fields[type,field:out] 766 _Compile Blueprint Fields[type,field:out]
755 { 767 {
756 name <- [field]Index[0] 768 name <- [field]Index[0]
757 ftype <- [field]Index[1] 769 ftype <- [field]Index[1]
758 out <- [type]Add Field[name,ftype] 770 out <- [type]Add Field[name,ftype]
981 { 993 {
982 Print[ ["Find Worker@NProgram: "]Append[name] ] 994 Print[ ["Find Worker@NProgram: "]Append[name] ]
983 out,notfound <- [[prog]Worker Refs >>]Index[name] 995 out,notfound <- [[prog]Worker Refs >>]Index[name]
984 } 996 }
985 997
998 Find Method@NProgram[prog, name, type:out,notfound]
999 {
1000 bp,notfound <- [[prog]Blueprints >>]Index[[type]Name >>]
1001 ,notfound <- If[[bp]Understands Method[name]]
1002 {
1003 out <- [[prog]Workers >>]Index[[[name]Append["@"]]Append[[type]Name >>]]
1004 }
1005 }
1006
1007 Find Field@NProgram[prog, name, type:fieldtype,notfound]
1008 {
1009 bp,notfound <- [[prog]Blueprints >>]Index[[type]Name >>]
1010 fieldtype,notfound <- [bp]Get Field Type[name]
1011 }