object1.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. package core
  2. import (
  3. "time"
  4. "regexp"
  5. "math/big"
  6. "kumachan/standalone/ctn"
  7. )
  8. type Object =
  9. *ObjectImpl
  10. //
  11. type ObjectImpl interface {
  12. impl(*ObjectImpl)
  13. }
  14. func Obj(o ObjectImpl) Object {
  15. return &o
  16. }
  17. // Reflect
  18. func (ReflectType) impl(Object) {}
  19. func (ReflectValue) impl(Object) {}
  20. // Primitive
  21. func (Bool) impl(Object) {}
  22. func (Int) impl(Object) {}
  23. func (Float) impl(Object) {}
  24. func (Bytes) impl(Object) {}
  25. func (String) impl(Object) {}
  26. func (Char) impl(Object) {}
  27. func (RegExp) impl(Object) {}
  28. func (Enum) impl(Object) {}
  29. func (Time) impl(Object) {}
  30. func (File) impl(Object) {}
  31. func (Error) impl(Object) {}
  32. type Bool bool
  33. type Int struct { Value *big.Int }
  34. type Float float64
  35. type Bytes ([] byte)
  36. type String string
  37. type Char rune
  38. type RegExp struct { Value *regexp.Regexp }
  39. type Enum int
  40. type Time time.Time
  41. type File struct { Path string }
  42. type Error struct { Value error }
  43. // Rx
  44. func (Observable) impl(Object) {}
  45. func (Subject) impl(Object) {}
  46. // Interface and Lambda
  47. func (Interface) impl(Object) {}
  48. func (Lambda) impl(Object) {}
  49. type Interface struct {
  50. UnderlyingObject Object
  51. DispatchTable *DispatchTable
  52. }
  53. type Lambda struct { Call func(Object)(Object) }
  54. // Container
  55. func (List) impl(Object) {}
  56. func (Seq) impl(Object) {}
  57. func (Queue) impl(Object) {}
  58. func (Heap) impl(Object) {}
  59. func (Set) impl(Object) {}
  60. func (Map) impl(Object) {}
  61. type Queue ctn.Queue[Object]
  62. type Heap ctn.Heap[Object]
  63. type Set ctn.Set[Object]
  64. type Map ctn.Map[Object,Object]
  65. // Algebraic
  66. func (Record) impl(Object) {}
  67. func (Union) impl(Object) {}
  68. type Record struct {
  69. Objects [] Object
  70. }
  71. type Union struct {
  72. Index int
  73. Object Object
  74. }
  75. // GUI
  76. func (Action) impl(Object) {}
  77. func (Widget) impl(Object) {}
  78. func (Signal) impl(Object) {}
  79. func (Events) impl(Object) {}
  80. func (Prop) impl(Object) {}