AHK v2 equivalent for SetFormat

Discuss the future of the AutoHotkey language
User avatar
lmstearn
Posts: 245
Joined: 11 Aug 2016, 02:32
GitHub: lmstearn
Contact:

AHK v2 equivalent for SetFormat

19 Jul 2019, 09:50

Back here, there is:
jeeswg wrote:
29 Mar 2017, 14:31
SetFormat (use the Format function on individual items, versus a SetFormat mode on all subsequent items)
Will Format ever possess the facility to set the format on all subsequent items, or will that functionality be lost? Or is there some kind of directive alternative to SetFormat in the offing?
Edit: Reference this thread where there is a bit of user aversion to the curly bracket thingies in Format. It might make the expression for our shrinking bracketeurs a little more readable by replacing the surrounding quotes with FormatStr(content_within_quotes) but then there is the extra issue of escaping ")" and the rest.
SetFormat is quite useful in report generation, where it's desired to output e.g. an integer as hex or float for certain sections of code. This could mean tailoring of the code structures so to accommodate SetFormat statements within it, not an issue as the flow in output routines is generally top-down.
In absolute terms, Format is far superior, and with a bit of extra work for the user, it can replace all the functionality of SetFormat by the implementation of delegate-like subs in the script. If it can be be applied to operate on the ensuing lines of the script like so:

Code: Select all

Format,  (returnStr OR Lines),  (FormatStr , Values...)
Where Lines is reserved to effect SetFormat in the manner as referenced in its Help entry, then, yes, bid farewell to Setformat.
Thanks.
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
Helgef
Posts: 4031
Joined: 17 Jul 2016, 01:02
Contact:

Re: AHK v2 equivalent for SetFormat

26 Jul 2019, 04:06

Will Format ever possess the facility to set the format on all subsequent items, or will that functionality be lost?
I can't imagine that happening. The functionality is more likely to be indirectly provided by the ability to override the (hypothetical) tostring methods for integers and doubles.

My guess is as good as yours though.

Cheers.

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 9 guests