Josh Triplett
    • Create new note
    • Create a note from template
      • 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
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me 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
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • 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 Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me 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
    # Ambitious Wild Ideas and Vibe Checks Josh Triplett Let's do more than path-dependent hill-climbing and annealing. Let's get out of local maxima. 3-4 minutes, to give plenty of time for everyone's ideas, we can circle back around. What if we made the standard library a regular crate? Instead of no_std, you can add alloc as regular features. Jacob Pratt spoke on that last year. Hard but possible, long-term. Came from Go to Rust. Surprised that you can't just cross-compile with one command. Linker, compiler, etc. zig build Would like to see clippy decomposed into smaller projects to make it easier to develop your own lints. Have a core that makes lint development easy. Have rust-analyzer-specific lints that you don't want to see in the command line. Have native lint-development framework in rustc (e.g. AST matching). Many organizations may want to have internal lints! Don't have to write mod.rs, Rust will infer it for you. What if Rust supported erased types? Traits can be object-safe or not. What if every trait could be used in an object context? AFIT, what do you do with the future that comes back? (Yes, please! Lang is looking at doing this!) Bit fields and bit packing! Not like C where it's UB, but where it's safe. Build it into the language, so you don't have to use macros. Enum discriminants and where those are. Do you care about matching an existing layout or just packing things? Match an existing layout. "Move-only fields" would help with packing things in. Linear types! Aggressively encode type safety into the type system. Get the LLVM IR from rustc, want to move things to a GPU and autodifferentiate it or run Polyhedral optimization, or otherwise transform LLVM IR and hand it back to the compiler, without being part of the compiler. Working on a project goal for GPUs and autodiff. Want to not worry about supporting other backends. E.g. Julia uses this. Java also has a prototype for Reflection with these examples. semver checks. Could we make it mandatory? Could we make it better integrated? Make it automatic on publish? Want to let people override it, but want it to be deliberate. Auditing unsafe code is basically unscalable. Would like to require safety comments by default. Could we add it to an opt-in thing for crates? Idioms. Add structure to safety invariants. Pre/post conditions, or just more structured prose. - Sometimes unsafe code is dependent on a const's value and people want to cross-link that, see https://github.com/toml-rs/toml/pull/720 We discourage people to use unsafe for things that aren't memory safety. But some project have their own constraints they want to enforce, e.g. bug-prone functions. Could we extend the concept of unsafety to annotate other kinds of functions? Similar mechanisms for no panics in this chain. Incremental linking! Could we build wild into rustc? Record types! I process JSON, I'd like to have this for ad-hoc formats. Rho polymorphism; ocaml has it. Also see Esteban's recent proposals. cargo-publish is a low-level tool, there are cargo release and release-plz and other tools. Could we stop recommending publish to new users and recommend tools that enforce best practices? Would help catch latent mistakes. e.g. the code that was published doesn't match any tag, has files that weren't meant to be there, we don't validate that the repo matches at all... - See https://doc.rust-lang.org/cargo/reference/publishing.html#publishing-a-new-version-of-an-existing-crate Make const the default! "ooooooooh!" from the room "const" isn't an effect/transformer/etc, "runtime"/"IO" is the effect/transformer. What's the *most* consty thing to be the default? koka's "total" is more pure than Haskell's pure. macro_rules are terrible, replace them with comptime from zig. Is comptime equivalent to proc macros? Modulo layering complications Multi-stage compiler. proc macro just takes a token stream, because we didn't want to stabilize more than that Could we stabilize more than that? Struct names and fields, for instance? Expose more things that aren't just surface syntax. More power to macro rules! Do more without proc macros! Derive with macro rules! attribute position macro rules! Security and sandboxing! Also, sandboxed proc macros. People use `build.rs` for three reasonable things, and a lot of unreasonable things. Give people a non-`build.rs` for those three-ish things, so `build.rs` stands out more. - snapshot testing for code-gen - system-deps for `-sys` crates - `cfg(accessible)` for build probes (except nightly which is rejected by the Cargo team) Append-only attribute macros, or some way of marking attribute macros as append-only? Know that the code that's there will stay there. There's a known soundness hole in zerocopy that would be easier to avoid if we had this. Compiler warnings from proc macros. RPIT to be able to call trait methods on a value of that input trait, without the trait in scope. Demo: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0c7957e414c8ac6f853b7fc7a7bd5a1b You can currently return an impl trait and can later return a concrete type; this would break. Inherent traits? Could we add `-> ConcreteType + impl InherentTrait`, to *add* an inherent trait even if it isn't inherent to ConcreteType? `cargo new` should be more opinionated README, CI configuration, etc Everything but the code! - https://github.com/rust-lang/cargo/issues/5151 - https://github.com/rust-lang/cargo/issues/5656 Actually use SPDX identifiers Pull in a popular license? `--license SPDX-ID` and automatically apply the license correctly. Put big scary warnings on non-OSI licenses on crates.io publish = false should be the default! - https://github.com/rust-lang/cargo/issues/6153 We're very heavy on "we check everything at declaration time". Good in some ways, obnoxious in others. Might want to write a debug macro 20 calls deep, and not put `: Debug` on everything. In const fn you can get use-time errors. We already have these, could we get away with more. maybe it'd be fine to have ```rust= fn add<T: Add>(x: T, y: T, z: T) -> T { x + y + z } ``` instead of needind to talk about the generic and associated types too. (Especially with cargo semver-checks that could check stuff anyway!) Could we have `if T impls Trait` Enforce more kinds of compile-time requirements? "keep this sorted". Dereference something that's not a pointer, as something that's not a reference. Deref without a `&`. ndarray. Indexing? Receiver types RFC? Can't deref with that though. Arbitrary self types? Does Erlang have something to learn from here? Result autowrapping. Throw syntax for functions that return a Result. Don't have to wrap all of my return paths in Ok. Anonymous enums Anonymous sum types Note: some things can't be delegated. Opt-in per trait. & in Rust means a reference, `||` means a closure, get rid of `&&` and `||` and use `and` and `or` re bitfields and discriminants Was writing a GB emulator, had a giant enum for Z80 instructions, would love to make its layout match the actual hardware instructions Logical representation vs physical representation Stable has fewer bugs than nightly but doesn't allow unstable features Connecting those is weird Would like to be able to use unstable features on stable, but still have fewer bugs. AOSP does this. If I add feature gates to a module, I end up playing whackamole with rustc lints Lint the code that's inside the feature gate Specifically, see through for unused (dead code). `cargo add`, automatically add it to workspace dependencies, and as a workspace dependency to the current crate. - https://github.com/rust-lang/cargo/issues/10608 `cargo new --workspace` - https://github.com/rust-lang/cargo/issues/8365 Serialize iterators in a way that I can recover them later. Run cargo-semver-checks, it completes some things and not others, the others are iterators in progress, dump and reload them. Specify for each crate the default target configuration Default cross target *per-package* - https://github.com/rust-lang/cargo/issues/6179 - https://github.com/rust-lang/cargo/issues/9208 Please raise things on internals.rust-lang.org, or Zulip, or social media...

    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