Skip to content

I can enter the same keyword argument twice, and the second over-rules the first #16937

Closed
@colintbowers

Description

@colintbowers

A short example:

f(x::Int ; kw::Int=0) = x * kw
f(2)
f(2, kw=3) #evaluates to 6
f(2, kw=3, kw=4) #evaluates to 8

I'm on v0.4, but I asked about it on the julia-users list here, and was told you can still do this in v0.5. The link also contains an argument for why this might be considered a feature and not a bug. Personally, it feels more like a bug to me - but I am a very small voice.

I stumbled onto this when typing out several keyword arguments, and my mind was still on the previous keyword as I typed the next one, and so I accidentally typed it twice. Easy to do, and it took me quite a while to work out where I'd gone wrong.

Metadata

Metadata

Assignees

Labels

breakingThis change will break codecompiler:loweringSyntax lowering (compiler front end, 2nd stage)error handlingHandling of exceptions by Julia or the user

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions