Rust objc2
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # `objc2` meeting 2024-06-20 Datetime: 2024-06-20T20:00:00Z UTC Attended: @madsmtm, @simlay and @silvanshade ## Introductions Who are you? Why are you here? (Motivation?) Generally: Improve the user-story for bindings in Rust. ## My general plan for `header-translator` `header-translator` mostly innovates on `bindgen` with the following things: - File-to-file - Nullability attributes - Configuration file - Focus on pre-generating rather than generating in `build.rs` All of these are things that I'd like to upstream into `bindgen` at some point. ### LibTooling / LLVM @silvanshade can probably say something more about how this works. @madsmtm is still confused as to the relationship between LibTooling and Libclang and LLVM's headers in general. In any case, one idea would be to focus on distributing the `header-translator` binary instead of LLVM binaries? Other thoughts: - Can we improve Libclang instead? ### Diffing I'm about to begin on my bachelor's degree, and have plans to develop an algorithm for diffing and merging N similar files, which I will use to generate Apple bindings for all the different targets that we support, and then merging them afterwards. ## Rust Project Goals The Rust project has [a project goal][c-proj-goal] related to better C interop, I/@madsmtm is considering hijacking that project goal, and using it to improve `bindgen` in general. I haven't talked to @emilio yet, I really should. [c-proj-goal]: https://rust-lang.github.io/rust-project-goals/2024h2/Seamless-C-Support.html --- ### simlay's general notes: - How do we generate reasonable documentation for generated bindings? I/@simlay authored https://github.com/madsmtm/objc2/pull/435 a year ago but didn't get around to actually using/evaluating the documentation generated. ### silvanshade's general notes: - how do we convince people that `libclang` and `bindgen` are not enough? - the above seemed like a problem when we asked about distributing llvmup components with rustup - re: how to distribute libraries and tooling - re: issues related to how to build and link against llvm and clang (external tools) - re: issues with using ClangImporter (needs swift llvm fork; implications of this wrt to wider adoption) - discussion of issues regarding pre vs. on-demand generation (objective-C vs C++ vs ...) - discussion of use of procedural macros vs other approaches - discussion of approaches used in bindgen vs cxx vs auto-cxx vs cxx-auto - re: discuss usage of C++ template metaprogramming (type-traits, concepts, SFINAE, etc) - can we leverage similar facilities from objective-C runtime? (what is available and can we use more?) - discuss possibility of evolving cxx-auto into a general tool - use more TMP + runtime introspection - use less cxx - bind enough of AST and ClangImporter modules to bootstrap - re-implement codegen - beyond C, C++, Objective-C: what about Swift, Mojo? - discuss crABI? ### silvanshade's libtooling notes: - libtooling: https://clang.llvm.org/docs/LibTooling.html - libclang: https://clang.llvm.org/docs/LibClang.html - some comparison between them: https://clang.llvm.org/docs/Tooling.html Main point of distinction is (which they note) that libclang does not provide you full control over the Clang AST. In general LibTooling is a subset of the larger (unstable) LLVM/Clang C++ APIs. It's the fragment oriented most toward developing tools for things like static analysis, and includes additional features like command line parsing, etc., which go beyond the compiler engine APIs. This is what is used for tools like `clang-format`, etc. Regarding the status of libclang, there are two issues: 1. It has drastically simplified interface to the internal Clang APIs and purposely does not expose complex lower-level functionality (which we really need) 2. It has become somewhat outdated even for it's original purpose, as I understand it I don't have a good reference for point 2 off the top of my head but I'm pretty sure I've read some notes about this somewhere in the LLVM project and of course it's sort of clear if you really try to start using libclang for advanced purposes. As for whether it's possible to improve it re: madsmtm's earlier thought, I suspect it's not feasible for a few reasons: 1. We'd have to figure out how to map missing functionality from the C++ APIs into the C 2. We'd have to implement all of that (in C, and then in Rust interfacing with the C) 3. We'd have to go through a probably difficult process of getting all of that upstreamed My impression of the state of things is that there probably isn't a lot of interest (on the LLVM project) side in improving libclang, because it's so far behind the C++ APIs. (Having said that, I believe I did see an attempt *somewhere* to develop either a modernized version of libclang or maybe an attempt to add missing functionality. I can't remember where I saw it now though. I thought it might have been this: https://github.com/JuliaInterop/Clang.jl But it sounds like they are just using the stable interface so maybe not.) Most focus these days seems to be on MLIR related things, and in fact there's currently the problem that Clang itself doesn't really use MLIR and there's some interest in pushing to change a lot of internal stuff over to that. Mojo kind of shows what's possible by fully embracing that approach. (For that matter, Rust doesn't use MLIR either but probably would benefit from it; I believe they face a similar issue with not having good access to the MLIR APIs because they are C++ based.) **Question from Jan:** Is (lib)clang even the best approach? If we simply need an AST we might be better off with something like [tree-sitter](https://tree-sitter.github.io/tree-sitter/). There is already an ObjectiveC grammar available and the entire application is written in C so interop should be way less of a pain. - silvanshade: There probably is a tree-sitter grammar but that wouldn't really help us in this particular case because it's not so much about parsing as it is getting access to the fully resolved AST, which requires semantic analysis. (Technically, a more accurate parser could help us some, but in the end, we really don't want to have to re-implement semantic analysis ourselves because it's too difficult.)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully