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

Proof of concept for minimum macos version in @objcproperties #47

Closed
wants to merge 2 commits into from

Conversation

christiangnrd
Copy link
Contributor

(#46)

Copy link

codecov bot commented Dec 28, 2024

Codecov Report

Attention: Patch coverage is 26.31579% with 14 lines in your changes missing coverage. Please review.

Project coverage is 70.62%. Comparing base (6911018) to head (87c7da9).
Report is 18 commits behind head on master.

Files with missing lines Patch % Lines
src/ObjectiveC.jl 0.00% 10 Missing ⚠️
src/syntax.jl 55.55% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #47      +/-   ##
==========================================
- Coverage   71.91%   70.62%   -1.29%     
==========================================
  Files          10       11       +1     
  Lines         769      909     +140     
==========================================
+ Hits          553      642      +89     
- Misses        216      267      +51     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maleadt
Copy link
Member

maleadt commented Jan 6, 2025

Alternatively, we could extend the objcproperties macro to e.g. do a macroexpand when it encounters a @static or other unrecognized constructs, enabling:

@objcproperties MPSNDArray begin
    @autoproperty dataType::MPSDataType
    @autoproperty dataTypeSize::Csize_t
    @autoproperty device::id{MTLDevice}
    @autoproperty label::id{NSString} setter=setLabel
    @autoproperty numberOfDimensions::NSUInteger
    @autoproperty parent::id{MPSNDArray}

    #Instance methods that act like properties
    @static if Metal.macos_version() >= v"15"
        @autoproperty descriptor::id{MPSNDArrayDescriptor}
        @autoproperty resourceSize::NSUInteger
        @autoproperty userBuffer::id{MTLBuffer}
    end
end

... because this works fine with regular structs:

julia> struct Foo
       bar
       @static if true
       f
       end
       end
julia> fieldnames(Foo)
(:bar, :f)

julia> struct Foobar
       bar
       @static if false
       f
       end
       end
julia> fieldnames(Foobar)
(:bar,)

@christiangnrd
Copy link
Contributor Author

christiangnrd commented Jan 6, 2025

Alternatively, we could extend the objcproperties macro to e.g. do a macroexpand when it encounters a @static or other unrecognized constructs, enabling:

Yes I like that idea. I'll have to spend time learning how to write macros so I'm not exactly sure when I'll get around to it. If anyone wants/needs this sooner feel free to take over.

@maleadt
Copy link
Member

maleadt commented Jan 6, 2025

I'll take a look.

@maleadt
Copy link
Member

maleadt commented Jan 7, 2025

Superseded by #48

@maleadt maleadt closed this Jan 7, 2025
@christiangnrd christiangnrd deleted the minver branch January 7, 2025 13:10
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.

2 participants