HSL functions with arbitrary number of parameters

Hi

There are some examples of functions in HSL that can take any number of arguments. For example, Trace() can accept as many arguments as required.

When creating an HSL function, how can we designate that we would like similar behaviour? Pre-defining X number of arguments and then requiring the user to put “” for arguments they don’t need is a bit cumbersome…

Thanks.

@Gareth - I don’t believe it is possible to construct functions in HSL (or method editor) that don’t have a defined number of parameters. The native element and library functions available in HSL that support variable argument lists adhere to different rules than custom functions written by a programmer.

Your best bet might be to provide an array as a parameter, where your function can then retrieve a variable number of parameters as element values.

If that doesn’t work, let me know what type of function you are trying to write, and I may be able to provide further suggestion.

-Nick

1 Like

Ah, that’s what I was concerned about - that’s a shame, but thank you for the confirmation. I guess the workaround is writing a .dll that is then used in the HSL, which seems like a lot of work for little gain.

I’m essentially trying to create a logging system (akin to logging — Logging facility for Python — Python 3.11.2 documentation, Apple Developer Documentation etc), but ideally dont want lots of LogX() functions that take X arguments, which then are a pain when you need to add an extra argument afterwards.

Maybe arbitrary argumets (like VBA paramarrays) are something to add to the feature requests for a future version of Venus? Or even better tracing along the logging frameworks I mentioned?

Thank you again @NickHealy_Hamilton

1 Like

I can relay your request to the product manager.

Regarding the additional tracing/logging, what type of data are you wishing to capture?

Thanks Nick.

In terms of data logging, I suppose it’s just normal debugging info and documentation info really, but we want a bit more control over how it is presented. Probably would need to talk privately more about this - maybe at SLAS?

I will not be in attendance this year at SLAS, but @EricSindelar_Hamilton and the product management team will be!

They will be happy to arrange a discussion.

-Nick

2 Likes

Awesome, I’ll get in touch with @EricSindelar_Hamilton et al to organise something, my colleague and I are certainly wanting to have a chat with you guys!

One way to get around it is to reference a database or separate file, e.g. .csv or excel file for those parameters

Yeah, you can, but that’s even more overhead than just having the ability to have any number of arguments… It’s strange that HSL doesn’t have this feature to be honest.