!LWeFyHFMHOGSzzpoxN:matrix.org

rash-lang

42 Members
Rash: The Reckless Racket Shell2 Servers

Load older messages


SenderMessageTime
9 Mar 2021
@bostx123:matrix.orgbostx123 *

My rashrc contains:

#! /usr/bin/env racket
;; emacs - set major mode: SPC h M racket-mode

(displayln "=== Loading rashrc")

;; rashrc is NOT a module, and gets none of them. rashrc is mainly there to let
;; you muck up the namespace that you use interactively. Prefer rashrc.rkt
;; @secref["Interactive_Use" #:doc '(lib "rash/scribblings/rash.scrbl")]
(current-repl-display-startup-hints? #f)

(define-line-macro f
(lambda (stx)
(syntax-parse stx
[(_) #'{echo "foo"}])))

and rashrc.rkt:

#lang racket

(displayln "=== Loading rashrc.rkt")

(require
 linea/line-macro
 (for-syntax syntax/parse))

(define-line-macro b
  (lambda (stx)
    (syntax-parse stx
      [(_) #'{echo "bar"}])))

The line-macro f works but the b does not. Does anybody know why? (My racket-fu is too young. Sorry guys)

13:19:23
@bostx123:matrix.orgbostx123 *

My rashrc contains:

#! /usr/bin/env racket
;; emacs - set major mode: SPC h M racket-mode

(displayln "=== Loading rashrc")

;; rashrc is NOT a module, and gets none of them. rashrc is mainly there to let
;; you muck up the namespace that you use interactively. Prefer rashrc.rkt
;; @secref["Interactive_Use" #:doc '(lib "rash/scribblings/rash.scrbl")]
(current-repl-display-startup-hints? #f)

(define-line-macro f
(lambda (stx)
(syntax-parse stx
[(_) #'{echo "foo"}])))

and rashrc.rkt:

#lang racket

(displayln "=== Loading rashrc.rkt")

(require
 linea/line-macro
 (for-syntax syntax/parse))

(define-line-macro b
  (lambda (stx)
    (syntax-parse stx
      [(_) #'{echo "bar"}])))

The line-macro f works but the b from rashrc.rkt does not. Does anybody know why? (My racket-fu is too young. Sorry guys)

13:19:53
@bostx123:matrix.orgbostx123 *

My rashrc contains:

#! /usr/bin/env racket
;; emacs - set major mode: SPC h M racket-mode

(displayln "=== Loading rashrc")

;; rashrc is NOT a module, and gets none of them. rashrc is mainly there to let
;; you muck up the namespace that you use interactively. Prefer rashrc.rkt
;; @secref["Interactive_Use" #:doc '(lib "rash/scribblings/rash.scrbl")]
(current-repl-display-startup-hints? #f)

(define-line-macro f
  (lambda (stx)
    (syntax-parse stx
      [(_) #'{echo "foo"}])))

and rashrc.rkt:

#lang racket

(displayln "=== Loading rashrc.rkt")

(require
 linea/line-macro
 (for-syntax syntax/parse))

(define-line-macro b
  (lambda (stx)
    (syntax-parse stx
      [(_) #'{echo "bar"}])))

The line-macro f works but the b from rashrc.rkt does not. Does anybody know why? (My racket-fu is too young. Sorry guys)

13:20:53
@willghatch:matrix.orgwillghatch bostx123: The difference is that because rashrc.rkt is a module (unlike rashrc), you have to deal with the provide semantics of the #lang its written in. Since you wrote it in #lang racket, you have to explicitly provide the bindings to things you want. You can use (provide (all-defined-out)) if you just want all the bindings. 16:47:54
@willghatch:matrix.orgwillghatch As an aside, you will get faster loading time if you use #lang racket/base instead of #lang racket. 16:48:17
@bostx123:matrix.orgbostx123 willghatch: I need the #lang racket because #lang racket/base leads to lambda: unbound identifier; 16:53:48
@bostx123:matrix.orgbostx123

and adding (provide (all-defined-out)) results in

> b
Result 1:
echo: undefined;
 cannot reference an identifier before its definition
  in module: top-level
16:54:59
@github:maunium.netGitHub [willghatch/racket-rash] willghatch commented on issue #74: [Windows] libedit-3.dll issues:

On Mon, Mar 08, 2021 at 10:30:28AM -0800, noweb-user wrote:

I believe the problem I have is that rash-repl.exe is a 64-bit application and I can't find a 64-bit version of readline. I believe we cannot mix two architectures in the same program.

Aha!

--8<---------------cut here---------------start------------->8--- %file rash-repl.exe libhistory8.dll libreadline8.dll rash-repl.exe: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows libhistory8.dll: PE32 executable (DLL) (console) Intel 80386 (stripped to external PDB), for MS Windows libreadline8.dll: PE32 executable (DLL) (console) Intel 80386 (stripped to external PDB), for MS Windows --8<---------------cut here---------------end--------------->8---

Since I cannot find a 64-bit application, would it be much trouble for you to compile rash-repl.exe as a 32-bit application? I believe this would take care of things for me and, therefore, for practically all other Windows users --- having this exact issue.

Did you install the 64-bit version of Racket? When you raco pkg install rash I assume it compiles it according to the version of Racket you installed. Perhaps Racket is bundling the wrong version of libedit? At any rate, I know some issues with libedit bundling were fixed in Racket 8.0, so it might already be fixed for newer Rackets.

I don't actually distribute a pre-built executable, just a Racket package definition which raco pkg knows how to build.

But I know you're busy. If this is not just another command for compiling this desired version, don't worry about it. I can manage to eventually compile the right library version for the right architecture.

Yeah, I'm not sure how to force Racket to build for a specific architecture, and I don't have time to dive into that right now. Sorry.

Thank you either way. I'm insisting because I think the software is great. I read your paper carefully in the last couple of days. Thanks for writing it.

Thanks! I hope to make time to make it better eventually!

16:58:59
@willghatch:matrix.orgwillghatch
In reply to @bostx123:matrix.org

and adding (provide (all-defined-out)) results in

> b
Result 1:
echo: undefined;
 cannot reference an identifier before its definition
  in module: top-level
Ah, looking at it again, I see you are trying to use Rash-style line-mode braces {} in #lang rash. In #lang racket, braces are the same as normal parentheses. So it's saying echo is unbound as a Racket identifier.
17:00:55
@willghatch:matrix.orgwillghatch To use {} in a rash-y way, you need to use #lang rash. 17:01:17
@willghatch:matrix.orgwillghatch (Or #lang linea racket or something -- the linea reader is what gives Rash its special braces) 17:01:53
@willghatch:matrix.orgwillghatch Also, when you use #lang racket/base you get the unbound lambda error because that lambda is for-syntax. So if you add (require (for-syntax racket/base)) it will fix that error when using #lang racket/base. But using #lang rash in rashrc.rkt is often a good idea because it gets a lot of boilerplate requires out of the way for writing rash code. 17:03:58
@willghatch:matrix.orgwillghatch Though I think #lang rash probably doesn't provide racket/base for syntax, so you probably need that same require for the macro... 17:04:54
@bostx123:matrix.orgbostx123

it looks like #lang rash and (require (for-syntax racket/base)) must be used in order to be satisfy the compiler, so here the code:

#lang rash

(displayln "=== Loading rashrc.rkt")

(require
 linea/line-macro
 (for-syntax racket/base syntax/parse))

(define-line-macro b
  (lambda (stx)
    (syntax-parse stx
      [(_) #'{ echo "bar" }])))

But it doesn't help because I still get

> b
Result 1:
resolve-command-path: can't find executable for b
17:09:58
@bostx123:matrix.orgbostx123 *

it looks like #lang rash and (require (for-syntax racket/base)) must be used in order to be satisfy the compiler, so here is the code:

#lang rash

(displayln "=== Loading rashrc.rkt")

(require
 linea/line-macro
 (for-syntax racket/base syntax/parse))

(define-line-macro b
  (lambda (stx)
    (syntax-parse stx
      [(_) #'{ echo "bar" }])))

But it doesn't help because I still get

> b
Result 1:
resolve-command-path: can't find executable for b
17:10:09
@willghatch:matrix.orgwillghatch You're still missing the provide. Add (provide b) and I think it will work. 17:11:31
@willghatch:matrix.orgwillghatch(I'll run it myself now to be sure...)17:11:47
@bostx123:matrix.orgbostx123Jeeeeeeeeeeeee :)17:12:16
@bostx123:matrix.orgbostx123It works now! :)17:12:22
@bostx123:matrix.orgbostx123
#lang rash

(displayln "=== Loading rashrc.rkt")

(require
 linea/line-macro
 (for-syntax racket/base syntax/parse))

(provide (all-defined-out))

(define-line-macro b
  (lambda (stx)
    (syntax-parse stx
      [(_) #'{ echo "bar" }])))

17:12:36
@willghatch:matrix.orgwillghatchYes, now that I finally copy/paste the code to actually run it, it works...17:12:39
@bostx123:matrix.orgbostx123Thank you Will!17:12:58
@willghatch:matrix.orgwillghatchI'm dissatisfied with the difficulty of figuring out what's wrong when a line-macro doesn't work.17:13:14
@willghatch:matrix.orgwillghatchBecause it just falls back to the line-macro default, it's hard to see when you mistyped a line macro or didn't provide it or something.17:13:47
@willghatch:matrix.orgwillghatch(Well, this is an issue when the default line-macro assumes an identifier is the name of a shell command, anyway, which is generally the case.)17:14:21
@willghatch:matrix.orgwillghatchBut I don't know of a good way to fix that.17:14:29
@bostx123:matrix.orgbostx123Well I guess a seasoned racketeer would figure it out... so yeah that's not who I am, hmm.17:14:46
@bostx123:matrix.orgbostx123 * Well I guess a seasoned racketeer would figure it out... but that's not who I am, hmm.17:15:04
@willghatch:matrix.orgwillghatchYeah... unfortunately Rash does assume some Racket knowledge. I'd like to make better tutorial material for people coming to Rash from different backgrounds to help with that. But I'm not sure when I'll get around to such a thing...17:15:59
@github:maunium.netGitHub [willghatch/racket-rash] willghatch pushed 2 commits to master: 17:17:30

Show newer messages


Back to Room ListRoom Version: 1