Helios-Environments.st 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. Smalltalk current createPackage: 'Helios-Environments' properties: #{}!
  2. Object subclass: #HLEnvironment
  3. instanceVariableNames: ''
  4. package: 'Helios-Environments'!
  5. !HLEnvironment commentStamp!
  6. Abstract class defining common behavior for local and remote environments!
  7. !HLEnvironment methodsFor: 'accessing'!
  8. packages
  9. ^ self subclassResponsibility
  10. ! !
  11. !HLEnvironment methodsFor: 'actions'!
  12. eval: someCode on: aReceiver
  13. ^ self subclassResponsibility
  14. ! !
  15. HLEnvironment subclass: #HLLocalEnvironment
  16. instanceVariableNames: ''
  17. package: 'Helios-Environments'!
  18. !HLLocalEnvironment methodsFor: 'accessing'!
  19. packages
  20. ^ Smalltalk current packages
  21. ! !
  22. !HLLocalEnvironment methodsFor: 'actions'!
  23. eval: someCode on: aReceiver
  24. | compiler |
  25. compiler := Compiler new.
  26. [compiler parseExpression: someCode] on: Error do: [:ex |
  27. ^window alert: ex messageText].
  28. ^(compiler eval: (compiler compile: 'doIt ^[', someCode, '] value' forClass: DoIt)) fn applyTo: aReceiver arguments: #()
  29. ! !
  30. HLEnvironment subclass: #HLRemoteEnvironment
  31. instanceVariableNames: ''
  32. package: 'Helios-Environments'!
  33. !HLRemoteEnvironment methodsFor: 'accessing'!
  34. packages
  35. "Answer the remote environment's packages"
  36. "to-do"
  37. "Note for future self and friends:
  38. the problem with remote stuff is that the answers shouldn't be expected to be
  39. received in a syncrhonous fashion. Everything network is asyc, so you *are going to deal with callbacks* here"
  40. ! !
  41. !HLRemoteEnvironment methodsFor: 'actions'!
  42. eval: someCode on: aReceiver
  43. "Note for future self and friends:
  44. whatever way this compilation happens on the other side,
  45. it should return a proxy to the remote resulting object"
  46. self notYetImplemented
  47. ! !
  48. Object subclass: #HLRemoteObject
  49. instanceVariableNames: ''
  50. package: 'Helios-Environments'!
  51. !HLRemoteObject commentStamp!
  52. This is a local proxy to a remote object.
  53. Tipically useful for evaluating and inspecting and interacting with instances of a remote VM.!
  54. !HLRemoteObject methodsFor: 'actions'!
  55. doesNotUnderstand: aMessage
  56. "to-do
  57. aham, blah blah
  58. super doesNotUnderstand: aMessage"
  59. !
  60. inspectOn: anInspector
  61. "to-do"
  62. "this is a source of so much fun..."
  63. !
  64. printString
  65. ^ 'this is a remote object'
  66. ! !