Stream: helpdesk (published)

Topic: Tuple unpacking with @nospecialize


view this post on Zulip Théo Galy-Fajou (Nov 07 2023 at 09:44):

I am wondering if this is a bug or just an irrational request:

I want to use @nospecialize on a Pair (or a Tuple, does not matter) and Julia normally allows you to unpack the pair directly in the function definition:

foo((a, b)::Pair) = ...

However, I would like to @nospecialize the Pair but

foo(@nospecialize (a, b)::Pair) = ...

does not seem to be valid syntax, I get:

ERROR: syntax: "(a, b)" is not a valid function argument name around REPL[4]:1

Any idea if it's expected behaviour?

view this post on Zulip Mason Protter (Nov 07 2023 at 10:03):

interesting, it's probably jsut that the implementation of @nospecialize was never updated when we added argument destructuring

view this post on Zulip Mason Protter (Nov 07 2023 at 10:03):

I'd open an issue, that's not expected behaviour

view this post on Zulip Théo Galy-Fajou (Nov 07 2023 at 10:18):

Cool thanks I will open one.

view this post on Zulip Théo Galy-Fajou (Nov 07 2023 at 10:20):

https://github.com/JuliaLang/julia/issues/52060

view this post on Zulip Timothy (Nov 07 2023 at 11:25):

This half reminds me of https://github.com/JuliaLang/julia/issues/49914


Last updated: Nov 06 2024 at 04:40 UTC