Hello,
Is it possible to get the method name inside the method definition?
For example, this.methodName.postln
posts the method name:
Object {
...
aMethod { arg ...;
...
this.methodName.postln;
...
}
}
best,
Hello,
Is it possible to get the method name inside the method definition?
For example, this.methodName.postln
posts the method name:
Object {
...
aMethod { arg ...;
...
this.methodName.postln;
...
}
}
best,
Foo {
getMethod { ^thisMethod }
}
See docs for Method
.
Thank you very much!
might be nice to compile a complete list of pseudo-variables? (or does this already exist somewhere…)
might be nice to compile a complete list of pseudo-variables? (or does this already exist somewhere…)
Thank you, but I am having some difficulty understanding what you described.
I used what @jordan taught me in Unify the warning message: ('|server) not running. by prko · Pull Request #6796 · supercollider/supercollider · GitHub
Server {
ping { |n = 1, wait = 0.1, func|
var result = 0, pingFunc;
this.checkRunning(
this.asCompileString ++ "." ++ thisMethod.asString.split($:)[1],
thisMethod.asString + "will NOT work."
...
);
...
checkRunning { |label, failMessage|
var msg;
if (this.serverRunning) { ^true };
msg = "server '%' not running.".format(this.name);
label !? { msg = "%\n %".format(msg, label) };
failMessage !? { msg = "%\n%".format(msg, failMessage) };
msg.warn;
^false
}
}
Example:
s.ping
WARNING: server ‘localhost’ not running.
s.ping
Server:ping will NOT work.
→ localhost
These are the ones the IDE syntax highlighting knows about (thisFunction, thisFunctionDef, thisMethod, thisProcess, thisThread, currentEnvironment, topEnvironment)
Lets move the conversion about keywords over here: Keywords in supercollider are weird as its a big one.