Sha256: 501bcd613ac26d5bc97c9148e60c0773b108f2502f6ffaa76c5765efcec0e371

Contents?: true

Size: 744 Bytes

Versions: 6

Compression:

Stored size: 744 Bytes

Contents

Object subclass: #MyScript
	instanceVariableNames: ''
	category: 'MyScript'!

!MyScript class methodsFor: 'main'!
main
	"Just a trivial example showing some meta programming by
	creating a class, compiling some methods and then exporting
	this package in javascript format to stdout"

	| klass compiler method |
	Object subclass: #Dummy instanceVariableNames: '' package: 'Dummy'.
	klass := Smalltalk current at: #Dummy.
	compiler := Compiler new.

	method := compiler load: 'foo ^10' forClass: klass.
	method category: 'foo'.
	klass addCompiledMethod: method.

	method := compiler load: 'bar ^ self foo * 2' forClass: klass.
	method category: 'foo'.
	klass addCompiledMethod: method.

	console log: (Exporter new exportPackage: 'Dummy')
! !


Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
mdbe-0.1.0 public/amber/examples/nodejs/meta/MyScript.st
maglev-database-explorer-0.0.5 public/amber/examples/nodejs/meta/MyScript.st
maglev-database-explorer-0.0.4 public/amber/examples/nodejs/meta/MyScript.st
maglev-database-explorer-0.0.3 public/amber/examples/nodejs/meta/MyScript.st
maglev-database-explorer-0.0.2 public/amber/examples/nodejs/meta/MyScript.st
maglev-database-explorer-0.0.1 public/amber/examples/nodejs/meta/MyScript.st