
A question, is there a keybinding for displaying the full path of an open file in a tab in DrRacket? After tracking a standard library definition via ‘Open Defining File’ I don’t know where that file is located in my filesystem since there isn’t enough information to get myself oriented.

@abmclin there isn’t a keybinding, I think — I usually use the little drop-down in the top-left which gives the directories that something is in

@samth ahh I see it now, and it gives me the information I wanted, thanks!

@samth since you are here, this is a good opportunity to ask you about the db package
, specifically Sqlite3. Sqlite3 supports extended result codes which augment primary error codes with more details. Does db package
already provide support for that? I’m currently searching through the source code to see if there’s anything there. So far it seems the answer is no.
In that case, would it be beneficial if I added support for extended result codes? My main use case is in testing, it’s useful to be able to know more precisely what kind of constraint is being exercised (or rather being failed) in test code. The primary error code for a constraint violation is too coarse grained, it doesn’t allow you to discriminate a key violation from say a check violation. So a test written to detect a constraint violation may pass incorrectly if the wrong constraint failed instead of the actual one intended to be tested.
I am envisioning adding another keyword to sqlite3-connect
, something like #:use-extended-error-codes
(any/c)

@abmclin that sounds like a good idea

I haven’t used the db pkg much, @ryanc would be the best person to ask

but I expect that a PR adding that would be very welcome

@samth @ryanc Ok great, I’ll put something together and then submit a PR against the db
github repository.

hmm, I have a macro that lifts an expression, stashes away that identifier, and then creates a macro that will expand to the identifier. this works fine when i use the resulting macro within the module, but if I try to use it at the REPL, I get a strange error: require: namespace mismatch;
reference to a module that is not available
reference phase: 0
referenced module: 'expanded module
referenced phase level: 0 in: lifted.1

is this “the top-level is hopeless”?

No. I’m guessing a little at what your code does, but I think the issue is that a module doesn’t have the same identity as expansion as when it is eventually instantiated. (The same module expansion might be instantiated at different module names.)

doesn’t look like it. it’s also broken if I try to use it from a module*

hmmmm. what would change a module’s identity?

if i use a sub-module instead of the repl I get a different error: “../plugin-update.rkt:258:11: lifted.1: undefined; cannot reference an identifier before its definition”

that’s a little interesting because I would expect the lift to happen in the module that is using the macro-generating-macro, not the module that defines the macro-generating-macro

The module identity connected to an identifier at expansion time is “the module being expanded”, so I think you’re somehow getting the identifier into the submodule with that same relative notion – but now it refers to a different module, and to an identifier that isn’t defined in the module

But I’m not clear on how you’re managing to do this, so maybe you can provide some code

(define-syntax (define-operation stx)
(syntax-parse stx
[(_ (priv-name:id ...) (name:id ctc:contract-spec))
(with-syntax ([contract (format-id #'name "~a/c" #'name)]
[(impl) (generate-temporaries #'(name))]
[(priv-contract ...) (generate-temporaries #'(priv-name ...))]
[runtime-dispatch-table (syntax-local-lift-expression #'(make-dispatch-table))])
(define priv-ids (syntax->list #'(priv-name ...)))
(define priv-ctcs (syntax->list #'(priv-contract ...)))
(define-values (rebound-mandatory dispatch-indices)
(rebind-mandatory stx #'ctc.mandatory priv-ids priv-ctcs))
(with-syntax ([(index ...) dispatch-indices])
#`(begin
(define priv-name
(priv 'priv-name 'priv-name any/c))
...
(define priv-contract
(priv/c 'priv-name priv-name))
...
(define contract
(->* #,(datum->syntax #'ctc.mandatory rebound-mandatory)
#,(check-ids stx #'ctc.optional priv-ids)
#,@(if (attribute ctc.rest) #'(#:rest #,(check-ids stx #'ctc.rest priv-ids)) #'())
(values #,@(check-ids stx #'ctc.results priv-ids))))
(define-syntax name
#,(operation (syntax->datum #'name) (attribute ctc.arity)
dispatch-indices (make-dispatch-table) #'runtime-dispatch-table
#'contract
(syntax-local-lift-expression
#`(make-keyword-procedure
(lambda (kws kw-args . args)
(let* ([types (parameterize ([current-inspector cap-inspector])
(list (let-values ([(type skipped?) (struct-info (list-ref args index))])
type) ...))]
[impl (dispatch runtime-dispatch-table types)])
(if impl
(keyword-apply impl kws kw-args args)
(apply raise-arguments-error 'name
(apply string-append (format "no instance for given capabilities~n existing instances: ~n")
(map (lambda (i) (format " ~a~n" i)) (get-instances runtime-dispatch-table)))
(foldr (lambda (l r a) (list* (format "~a" l) r a))
empty (list index ...) types))))))))))))]))

the relevant line is in the body of the (define-syntax name …). I’m guessing i’ve done the unquoting and requoting poorly. “operation” creates a struct that has a prop:procedure that makes it syntax, I eventually use that to pull out the id created using syntax-local-lift-expression

i’ll keep thinking about it

@abmclin, the sqlite code is actually in the main racket repo (/collects/db/private/sqlite/) because setup depends on it. It looks like the extended error code should be showing up in the “code: _” line of the exception already. Look at connection.rkt and the various macros, methods, and functions called “handle-status” or variations on that.

@ryanc I’m looking at connection.rkt at this very moment :slightly_smiling_face: I confirm that extended result codes are turned on by default. As far as I can tell, it appears that the Racket layer only parses the primary error codes, and ignores the extended details. I will continue to explore more.

I’ll check to see if “code: _” shows up in the exceptions I’m getting

@ryanc I see there’s (code . <symbol name>)
and (errcode . <number>)
in the details I get when I invoke exn:fail:sql-info
on an exn:fail:sql
value. Is that what you are referring to? Right now it only shows the primary error code name and number. Do I need to look in a different place?

@thinkmoore If I understand correctly, you’re “stashing” syntax by putting it into a syntax property; that’s the problem If you can expand to an expression that involves a quote-syntax
form, instead, it should fix the problem

@abmclin, on my system, when I run a query that violates a table’s uniqueness constraint, I get the following error in Racket: query-exec: abort due to constraint violation\n error code: 2067\n SQL: "insert into t (i) values (?)"
, where 2067 is the extended error code SQLITE_CONSTRAINT_UNIQUE

@ryanc very interesting! I’m running Racket 6.8 on a Windows 7 64-bit, using the db pkg
that came bundled with Racket. My understanding is sqlite3
is already bundled with db
. Running (sqlite3_libversion_number)
from ffi.rkt located in collects/db/private/sqlite3
directory gives me 3007008
. Hmm not sure why the extended error codes are not showing up for me. When I violate a table’s uniquess constraint, I get the following string query-exec: abort due to constraint violation\n error code: 19\n SQL: "INSERT INTO .... <truncated>"
Where 19 is the code for SQLITE_CONSTRAINT
. I truncated the SQL string for brevity.

I’ll try it on my Linux machine and give you a report.

(Sorry that I missed this until now.) Right B and anything else that B depends on must be converted first, if A depends on B.

Totally separate question, will the 6.9.0.1 version be available for downloading soon? I was installing pkgs for the 6.8 version on my Linux machine but the install is not working for me because the base pkg in the catalog is now pointing to 6.9.0.1.

@abmclin: 6.9.0.1 is not a release version number. It’s the version number that corresponds to the current master.

6.9 should be out by the end on the month. 6.9.0.1 is a bit ahead, but at this point, they’re almost the same.

@mflatt thanks for taking a look. it turns out the problem was that I was applying the operation struct constructor during the wrong phase.

6.9.0.1 will keep being developed, possibly reaching 6.9.0.2 along the way, and so on, and will serve as the basis for (most likely) 6.10.

ok so I should just wait on updating the 6.8 version I have till 6.9 is out?

@abmclin which pkg doesn’t work?

Basically, I was installing db pkg
for 6.8 after upgrading to 6.8 using ppa:plt/racket since I had 6.0 on my Linux machine which was too old.
raco pkg install db
asks if I want to install dependencies too which I say yes, it then fails with the following error:
raco pkg install: version mismatch for dependency for package: base mismatch packages: racket (have 6.8, need 6.9.0.1)


ok that’s odd

because the db
pkg should just be installed from the 6.8 catalog

maybe @asumu has some idea?

ok meanwhile I’ll hold off on that for the time being.

@abmclin I think the db
pkg should already be there in your installation, unless you installed the “minimal” version of racket

I think the ppa:plt/racket version is the minimal one.
Perhaps I should mention that when I first installed 6.8 from ppa:plt/racket and then ran racket
I got this error:
.racketrc:2:9: collection not found for module path: xrepl collection: “xrepl” in collection directories: /home/alexander/.racket/6.8/collects /usr/share/racket/collects context…: show-collection-err standard-module-name-resolver /usr/share/racket/collects/racket/interactive.rkt: [running body]

I might have gotten into a bad state somehow, I’m going to go ahead remove it completely and try again.

no, that just indicates that it’s minimal (but also that the default is set up poorly)

@abmclin: do you have racket-common installed too?

(there are three racket packages in the PPA: racket, racket-common, and racket-docs)

@asumu what catalog is set up by default in the racket
package?

here is output from apt-get on my machine


after apt-get autoremove racket
and doing apt-get install racket
again. I still get the collection not found for module path: xrepl when running racket

@abmclin what if you then do apt install racket-common
?

also, can you paste the output of raco pkg config
?

sudo apt install racket-common
gives me racket-common is already the newest version


ok

@asumu that config seems like the wrong thing for a release

@samth @abmclin the config.rktd in the ppa archive has a URL of <http://download.racket-lang.org/releases/6.8/catalog>
so that value must be coming from elsewhere.

weird

@asumu do you get the same thing when installing?

Maybe there is a user local config that Racket is reading?

Also if PLTCONFIGDIR
is set to a non-default option it may be reading the config from elsewhere.

@abmclin How about raco pkg config -i
?


running echo $PLTCONFIGDIR
doesn’t return any output

is there a config.rktd
somewhere on my system? If you can tell me where it is, I can examine it directly. Also I had 6.0 installed using an archived file downloaded from http://racket-lang.org\|racket-lang.org ages ago. Is it possible something left over from 6.0 is lingering somewhere?

@stamourv there seems not to be a v6.8 tag for TR in git. Did I screw something up there?


Did you do git pull —tags since 6.8?

(Why that’s not the default, I have no idea.)

@abmclin : can you show the result of evaluating (find-system-path 'config-dir)
? That should show where racket is looking for the config file.

And if it points somewhere unexpected, maybe you can try moving that file temporarily and see if it’s fixed.

@stamourv dammit, git

(or if you have locate
installed on your system, try locate config.rktd
)

@stamourv I’ve finished my checklist items and you can pull the history

@samth: Do you want me to cherry-pick the history? You’re the repo manager, but I can do it if you want.

I’ll do it

just letting you know if you wanted to do it now

@jeapostrophe what’s the default for the “type” argument to raco test
?

@stamourv also, I did all the remaining automated tests

@samth: Don’t tell me, tell the checklist. :)

I did

Good.

But I thought you might want to know why it shrank a bunch/that you didn’t need to worry about those

Good point.

@asumu doing a fresh install of 6.8 from ppa:plt/racket on my home Linux machine went without a hitch, it works fine and the expected pkgs are present. So that means something specific to the other Linux machine is the cause of the problem. I’ll follow up when I return to my office Monday. I expect (find-system-path 'config-dir)
should be enough to locate the problematic file and resolve the issue. Thank you for your help.