Consider promoting `@model` keyword-argument drop from `@warn` to `@error`

Open
#307 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
julia
Domain
compilers

Research direction

Start at src/model_macro.jl:959-961 and compare the keyword-argument handling with the existing positional-argument error at model_macro.jl:923. Inspect the existing @model macro tests for unsupported arguments, then establish whether the intended behavior is an error; done means the chosen behavior is covered consistently by tests.

Written by the indexing model from the issue text.

Description

Summary

src/model_macro.jl:959-961: keyword arguments in a @model function signature are parsed
and then ignored, with only a warning:

if !isnothing(ms_kwargs) && length(ms_kwargs) > 0
    @warn("Model specification language does not support keyword arguments. Ignoring $(length(ms_kwargs)) keyword arguments.")
end

Suggestion

A user writing @model function m(x; a=1) gets no a in the body; a later UndefVarError
is the only signal, and the @warn is easy to miss. Since unsupported positional
arguments already hard-error (model_macro.jl:923), consider promoting the kwarg case to an
error for consistency and earlier failure. Deliberate design choice — flagging for
discussion rather than a hard bug.

Dominant language
Julia
Stars
46
Forks
8
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ReactiveBayes/GraphPPL.jl

All issues in ReactiveBayes/GraphPPL.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.