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

Add curried versions of getproperty and getfield #42629

Open
krrutkow opened this issue Oct 13, 2021 · 1 comment
Open

Add curried versions of getproperty and getfield #42629

krrutkow opened this issue Oct 13, 2021 · 1 comment

Comments

@krrutkow
Copy link

In the spirit of having curried versions builtin functions (#32018, #36163, #36759, #42485 (comment), etc.), I often want to use something like getproperty(:field) and getfield(:field) instead of defining x -> x.field so often. getfield is a builtin and faces the same implementation challenges as isa, ===, etc.

Perhaps there could be one overarching issue to list/track the subset of builtin functions that should have curried versions implemented?

julia> subtypes(Core.Builtin)
36-element Vector{Any}:
 Core.IntrinsicFunction
 Core.var"##invoke"
 typeof(<:)
 typeof(===)
 typeof(Core._abstracttype)
 typeof(Core._apply_iterate)
 typeof(Core._apply_pure)
 typeof(Core._call_in_world)
 typeof(Core._call_latest)
 typeof(Core._equiv_typedef)
 typeof(Core._expr)
 typeof(Core._primitivetype)
 typeof(Core._setsuper!)
 typeof(Core._structtype)
 typeof(Core._typebody!)
 typeof(Core._typevar)
 typeof(Core.apply_type)
 typeof(Core.arrayref)
 typeof(Core.arrayset)
 typeof(Core.arraysize)
 typeof(Core.const_arrayref)
 typeof(Core.sizeof)
 typeof(Core.svec)
 typeof(applicable)
 typeof(fieldtype)
 typeof(getfield)
 typeof(ifelse)
 typeof(invoke)
 typeof(isa)
 typeof(isdefined)
 typeof(nfields)
 typeof(setfield!)
 typeof(throw)
 typeof(tuple)
 typeof(typeassert)
 typeof(typeof)
@adkabo
Copy link
Contributor

adkabo commented Dec 27, 2021

It's unfortunate that getindex(3) is already taken (returns 3).

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

No branches or pull requests

2 participants