talonvoice / talon

Issue Tracker for the main Talon app
85 stars 0 forks source link

Inserting alternate captures from Talon script fails with TypeError #221

Open nriley opened 3 years ago

nriley commented 3 years ago

I reported an issue with the following on the Talon Slack:

now (<phrase> | <user.number_string>):
[...]
    insert(" - {phrase or number_string}")

This works fine if i say a number after now, so number_string is used, but if I say anything else and populate phrase instead, I get:

2021-01-24 20:52:39 ERROR TalonScript TypeError in: [...]/onenote_global.talon:11
2021-01-24 20:52:39 ERROR Line 7: variable 'number_string' not found

The following suggestion worked around the issue:

number = number_string or ""
{phrase or number}

But I think this Talon script behavior is somewhat non-obvious and confusing.

(If the above example does not provide enough context, the actual script I am referring to is here).

lunixbochs commented 3 years ago

ok I've been thinking about this, I think the solution is nothing to do with the type system, and everything to do with making captures that didn't match available in some way to the running script

also relates to https://github.com/talonvoice/talon/issues/279 then