For Programmers: Free Programming Magazines  


Home > Archive > Smalltalk > July 2007 > Silly hack to add functions to Smalltalk









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Silly hack to add functions to Smalltalk
daredevil

2007-07-10, 7:11 pm

Create new class Functions

create new methods #funcall: and #funcall on Symbol
Symbol >> funcall: funArgs
^Functions perform:self withArguments: funArgs
Symbol >> funcall
^self funcall:nil

define whatever functions u want on class side of Functions.

invoke the function like
#+:and: funcall:#(3.4) ==> 7

where #+:and: is
Functions >> class >> +: a and: b
^a+b

Just a y'day night hack before sleeping :) Haven't used for anything
yet and hardly to ever ;)

daredevil

2007-07-11, 4:18 am

plese replace
^self funcall:nil
with
^self funcall: {}

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com