Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyword arguments with default value #8

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

aminya
Copy link

@aminya aminya commented Jan 9, 2020

Fixes #1

@aminya aminya force-pushed the default-value branch 2 times, most recently from 1c923f6 to 1c3dbfd Compare January 9, 2020 22:28
@aminya aminya force-pushed the default-value branch 2 times, most recently from 545a3eb to 3faf1fc Compare January 9, 2020 23:20
@aminya
Copy link
Author

aminya commented Jan 9, 2020

using KeywordDispatch
@kwdispatch f()
@kwmethod f(;a,b=2)=2

Method is defined but when called returns error f(a=2)

julia> f(a=2)
ERROR: KeywordMethodError: no keyword method matching f(::Int64; a::Int64)
Stacktrace:
 [1] kwcall(::NamedTuple{(:a,),Tuple{Int64}}, ::Function, ::Int64) at C:\Users\yahyaaba\Documents\GitHub\KeywordDispatch.jl\src\KeywordDispatch.jl:147
 [2] kwcall(::NamedTuple{(:a,),Tuple{Int64}}, ::typeof(f)) at C:\Users\yahyaaba\Documents\GitHub\KeywordDispatch.jl\p.jl:28
 [3] #f#12(::Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol},NamedTuple{(:a,),Tuple{Int64}}}, ::typeof(f)) at C:\Users\yahyaaba\Documents\GitHub\KeywordDispatch.jl\src\KeywordDispatch.jl:222
 [4] (::var"#kw##f")(::NamedTuple{(:a,),Tuple{Int64}}, ::typeof(f)) at .\none:0
 [5] top-level scope at none:0

@aminya aminya changed the title argtype with support for defaul value Keyword arguments with defaul value Jan 10, 2020
@aminya
Copy link
Author

aminya commented May 4, 2020

@simonbyrne Any solution for this?
Parsing of the keyword arguments with default values is done.
However, for creating the dispatcher I have problems.

@aminya aminya changed the title Keyword arguments with defaul value Keyword arguments with default value Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default keyword arguments
1 participant