Computer Science Canada

Why can't you call a function as input to your proc?

Author:  TokenHerbz [ Wed Nov 01, 2006 5:24 am ]
Post subject:  Why can't you call a function as input to your proc?

Example the code i attempted:

code:

proc setBoxText (var input := font_get (100, 100, Font.New ("times new roman:12:bold"), red): string)
        BoxText := input
    end setBoxText


The input fcn in itself works perfectly, though i wanted to call it when you make a new word for your box, as a proc parameter.

kinda like a type as you go deal, and it will finish the proc after your fcn (which is basicly like "get" with features)

I suppose i could just put it in the proc, but i was wondering why it wont call the fcn in its parameter.

Author:  Clayton [ Wed Nov 01, 2006 9:05 am ]
Post subject: 

because in Turing you can't assign parameters default values, or assign a parameter any kind of value in the declaration (you can in Ruby though!).

Personally, I don't see what's wrong with having your function being called from within the procedure itself anyways

Author:  Tony [ Wed Nov 01, 2006 9:38 am ]
Post subject: 

because a parameter is a placeholder for the value you pass (actually you could pass a function and execute that internally).

havin a constant function there does not make sense


: