Skip to content

Printing of kw-args with bang needs a space #34023

@mauro3

Description

@mauro3

Keyword arguments are usually written without space: fn(;a=1) = a^2. However if the kwarg ends in a bang this does not work:

julia> f(;fn!=x->x[1]=1) = 1
ERROR: syntax: invalid keyword argument syntax "(fn != x -> begin
    # REPL[24], line 1
    x[1] = 1
end)"
Stacktrace:
 [1] top-level scope at REPL[24]:1

and a space is needed. Could no-space be supported?

This would then also be consistent with the current printing of the Expr:

julia> Expr(:kw, :fn!, :a)
:(fn!=a)

Metadata

Metadata

Assignees

Labels

display and printingAesthetics and correctness of printed representations of objects.parserLanguage parsing and surface syntax

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions