On Fri, 22 May 2015, Rainer Gerhards wrote:
I'd say function is good until we have a compelling reason for something
else.
Sent from phone, thus brief.
Am 22.05.2015 22:41 schrieb "singh.janmejay" <[email protected]>:
So between
- function
- keyword
- function with named args
?
for me it depends on the complexity being expressed.
any time you transform something from one thing to another, you need a function.
I dislike the perl syntax like:
foo = sort keys %hash
and I dislike the Python
foo = hash.keys.sort
instead, function calls are much clearer about what's affected and where the
different functions start and end
foo = sort(keys(hash))
but for something that is a test, and can only give a true/false result (i.e.
something that you will do "if <something> then"), and it only involves two
items (one of which is always a variable), then I think good keywords work well.
a == b
a startswith b
a contains b
if it cannot be expressed with one variable and one other item (which can be a
variable or function return value), then it must be a function
If we did not already have contains and startswith, I could see avoiding this
entirely, but since we have these, I think continuing to use this approach for
other tests makes sense.
David Lang
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE
THAT.