blanks in ternary operator Topic is solved

Discuss the future of the AutoHotkey language
User avatar
jeeswg
Posts: 3583
Joined: 19 Dec 2016, 01:58
Location: UK

Re: blanks in ternary operator

24 Jan 2018, 16:53

- @coffee: Re. "". It's an important script error/conversion detail to know about. FWIW I did think up some of your for/against points, but my statement was neutral.

- This thread has a become a good collection of information re. omitted parameters. In that vein:
Object declaration syntax - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=37&t=43154
[] and {} already allow trailing commas in v2.
lexikos
Posts: 5686
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: blanks in ternary operator

25 Jan 2018, 17:33

If you are passing "", you are not omitting the parameter. "" is not a variable. For these built-in functions, the parameters are marked as "output variables", meaning only a variable is valid, and it must be writable.

ByRef does not require a variable, because that would defeat the ability to define a function to accept a varying number of variables. This might change if variadic functions are somehow improved to support variable references.

There is no good reason to pass "" when you mean to omit the parameter. If you get into that habit, you will get into trouble when you do it with a function which has a non-empty default value.

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 2 guests