GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    Grigory Shepelev (shegeley@fosstodon.org)'s status on Thursday, 14-Sep-2023 16:10:42 JST Grigory Shepelev Grigory Shepelev
    • Christine Lemmer-Webber
    • Andy Wingo
    • blake shaw 🇵🇸

    Question for #scheme ☯️ kings & queens 👑 ! Are there an alternative to clojure's alter-var-root https://clojuredocs.org/clojure.core/with-redefs in scheme?

    Imagine I have a module `(X)` with `(define a 1) (define-public (f x) (+ x a))` and module `(Y)` that has `#:use-module (X)`. In `(Y)` want to alter a from `(X)` in a way that would also affect `f`. Example: (being in module `(Y)`): `(alter! a 2) (equal? (f 3) 5) => #t`

    CC @wingo @rml @cwebber

    In conversation Thursday, 14-Sep-2023 16:10:42 JST from fosstodon.org permalink

    Attachments

    1. No result found on File_thumbnail lookup.
      with-redefs - clojure.core | ClojureDocs - Community-Powered Clojure Documentation and Examples
    • Embed this notice
      Andy Wingo (wingo@mastodon.social)'s status on Thursday, 14-Sep-2023 16:10:42 JST Andy Wingo Andy Wingo
      in reply to
      • Christine Lemmer-Webber
      • blake shaw 🇵🇸

      @shegeley @rml @cwebber most schemers are republicans, in the anti-monarchist sense :) but if the intended use case is global monkeypatching, then in guile `set!` is your tool. if `a` is exported, then just `set!` on `a`. if not, `(set! (@@ (X) a) new-val)`

      In conversation Thursday, 14-Sep-2023 16:10:42 JST permalink
      clacke likes this.
    • Embed this notice
      Andy Wingo (wingo@mastodon.social)'s status on Thursday, 14-Sep-2023 16:10:45 JST Andy Wingo Andy Wingo
      in reply to
      • Christine Lemmer-Webber
      • blake shaw 🇵🇸

      @shegeley @rml @cwebber but generally for this to be possible you need to have inhibited some optimizations by opting into a different dialect. see https://www.gnu.org/software/guile//manual/html_node/Declarative-Modules.html

      In conversation Thursday, 14-Sep-2023 16:10:45 JST permalink

      Attachments

      1. No result found on File_thumbnail lookup.
        Declarative Modules (Guile Reference Manual)
        Declarative Modules (Guile Reference Manual)
      clacke likes this.
    • Embed this notice
      Andy Wingo (wingo@mastodon.social)'s status on Thursday, 14-Sep-2023 20:21:13 JST Andy Wingo Andy Wingo
      in reply to
      • Christine Lemmer-Webber
      • blake shaw 🇵🇸
      • Andres Moreno

      @rml @shegeley @cwebber @monkey1 if your mental model is still “a top-level var reference necessarily loads the current value from its storage location” you need to be compiling without optimizations, otherwise you will have unpleasant surprises

      In conversation Thursday, 14-Sep-2023 20:21:13 JST permalink
      clacke likes this.
    • Embed this notice
      Andy Wingo (wingo@mastodon.social)'s status on Thursday, 14-Sep-2023 20:21:14 JST Andy Wingo Andy Wingo
      in reply to
      • Christine Lemmer-Webber
      • blake shaw 🇵🇸
      • Andres Moreno

      @rml @shegeley @cwebber @monkey1 the issue is entirely about language: is a define form essentially a creation of a mutable storage location along with an initial value? if so, AOT inlining of top-level definitions is impossible; the compiler cannot reason about the values of top-level / module-level definitions. guile moved away from this model with declarative modules.

      In conversation Thursday, 14-Sep-2023 20:21:14 JST permalink
    • Embed this notice
      blake shaw 🇵🇸 (rml@functional.cafe)'s status on Thursday, 14-Sep-2023 20:21:16 JST blake shaw 🇵🇸 blake shaw 🇵🇸
      in reply to
      • Christine Lemmer-Webber
      • Andy Wingo
      • Andres Moreno

      @shegeley @wingo @cwebber @monkey1 oh wait I think I misread your problem

      In conversation Thursday, 14-Sep-2023 20:21:16 JST permalink
    • Embed this notice
      Grigory Shepelev (shegeley@fosstodon.org)'s status on Thursday, 14-Sep-2023 20:21:17 JST Grigory Shepelev Grigory Shepelev
      in reply to
      • Christine Lemmer-Webber
      • Andy Wingo
      • blake shaw 🇵🇸
      • Andres Moreno

      @rml @wingo @cwebber @monkey1

      yep. the problem was totally in the testing env

      In conversation Thursday, 14-Sep-2023 20:21:17 JST permalink
    • Embed this notice
      blake shaw 🇵🇸 (rml@functional.cafe)'s status on Thursday, 14-Sep-2023 20:21:17 JST blake shaw 🇵🇸 blake shaw 🇵🇸
      in reply to
      • Christine Lemmer-Webber
      • Andy Wingo
      • Andres Moreno

      @shegeley @wingo @cwebber @monkey1 so you just need to create an alias? In that case (define my-alias the-original) works fine except when dealing with syntax. In that case, you can do

      (define-syntax my-alias
      (identifier-syntax the-original))

      Might have left something out of that bcs im writing from my phone, currently on the move, so lmk if that didn't work and ill take a look.

      In conversation Thursday, 14-Sep-2023 20:21:17 JST permalink
    • Embed this notice
      Grigory Shepelev (shegeley@fosstodon.org)'s status on Thursday, 14-Sep-2023 20:21:19 JST Grigory Shepelev Grigory Shepelev
      in reply to
      • Christine Lemmer-Webber
      • Andy Wingo
      • blake shaw 🇵🇸
      • Andres Moreno

      @rml @wingo @cwebber @monkey1

      it won't update setted variable's value in all procedures of `(X)` that uses `x`. `(define (square r pi) (* r r pi))` <-- here pi will stay 3.14 when `square` will be called from `(Y)`

      In conversation Thursday, 14-Sep-2023 20:21:19 JST permalink
    • Embed this notice
      Grigory Shepelev (shegeley@fosstodon.org)'s status on Thursday, 14-Sep-2023 20:21:19 JST Grigory Shepelev Grigory Shepelev
      in reply to
      • Christine Lemmer-Webber
      • Andy Wingo
      • blake shaw 🇵🇸
      • Andres Moreno

      @rml @wingo @cwebber @monkey1 probably the answer given was toatally correct. set! and stuff will work in repl, but won't when launched in the testing env that I just set up.

      In conversation Thursday, 14-Sep-2023 20:21:19 JST permalink
    • Embed this notice
      blake shaw 🇵🇸 (rml@functional.cafe)'s status on Thursday, 14-Sep-2023 20:21:20 JST blake shaw 🇵🇸 blake shaw 🇵🇸
      in reply to
      • Christine Lemmer-Webber
      • Andy Wingo
      • Andres Moreno

      @shegeley @wingo @cwebber @monkey1 whats the problem with `set!` in this scenario?

      In conversation Thursday, 14-Sep-2023 20:21:20 JST permalink
    • Embed this notice
      Grigory Shepelev (shegeley@fosstodon.org)'s status on Thursday, 14-Sep-2023 20:21:21 JST Grigory Shepelev Grigory Shepelev
      in reply to
      • Christine Lemmer-Webber
      • Andy Wingo
      • blake shaw 🇵🇸
      • Andres Moreno

      @wingo @rml @cwebber
      @monkey1

      Imagine that you have a module already written by someone that does the job you want to, but there is only one variable (example `(define pi 3.14)` ) that you want just override but otherwise would like everything to work as previously. Wouldn't like to copy-paste a one of code

      In conversation Thursday, 14-Sep-2023 20:21:21 JST permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.