abmclin
2017-4-21 14:10:29

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.


samth
2017-4-21 14:13:16

@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


abmclin
2017-4-21 14:13:56

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


abmclin
2017-4-21 14:24:37

@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)


samth
2017-4-21 15:18:30

@abmclin that sounds like a good idea


samth
2017-4-21 15:18:46

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


samth
2017-4-21 15:18:54

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


abmclin
2017-4-21 15:52:42

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


thinkmoore
2017-4-21 16:12:04

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


thinkmoore
2017-4-21 16:12:48

is this “the top-level is hopeless”?


mflatt
2017-4-21 16:14:56

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.)


thinkmoore
2017-4-21 16:14:58

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


thinkmoore
2017-4-21 16:15:33

hmmmm. what would change a module’s identity?


thinkmoore
2017-4-21 16:16:06

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”


thinkmoore
2017-4-21 16:16:41

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


mflatt
2017-4-21 16:17:12

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


mflatt
2017-4-21 16:17:25

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


thinkmoore
2017-4-21 16:19:37
(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))))))))))))]))

thinkmoore
2017-4-21 16:21:13

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


thinkmoore
2017-4-21 16:44:27

i’ll keep thinking about it


ryanc
2017-4-21 16:50:02

@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.


abmclin
2017-4-21 16:51:35

@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.


abmclin
2017-4-21 16:52:15

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


abmclin
2017-4-21 16:55:46

@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?


mflatt
2017-4-21 17:07:30

@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


ryanc
2017-4-21 17:51:51

@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


abmclin
2017-4-21 18:04:43

@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.


abmclin
2017-4-21 18:05:41

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


mflatt
2017-4-21 18:47:04

(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.


abmclin
2017-4-21 18:59:27

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.


stamourv
2017-4-21 19:06:44

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


stamourv
2017-4-21 19:07:23

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.


thinkmoore
2017-4-21 19:07:55

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


stamourv
2017-4-21 19:08:09

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.


abmclin
2017-4-21 19:08:27

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


samth
2017-4-21 19:09:53

@abmclin which pkg doesn’t work?


abmclin
2017-4-21 19:11:13

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)


abmclin
2017-4-21 19:12:38

samth
2017-4-21 19:19:57

ok that’s odd


samth
2017-4-21 19:20:11

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


samth
2017-4-21 19:20:29

maybe @asumu has some idea?


abmclin
2017-4-21 19:22:41

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


samth
2017-4-21 19:27:57

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


abmclin
2017-4-21 19:29:19

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]


abmclin
2017-4-21 19:29:42

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


samth
2017-4-21 19:36:58

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


asumu
2017-4-21 19:37:59

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


asumu
2017-4-21 19:39:03

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


samth
2017-4-21 19:41:03

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


abmclin
2017-4-21 19:42:15

here is output from apt-get on my machine


abmclin
2017-4-21 19:42:28

abmclin
2017-4-21 19:43:41

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


samth
2017-4-21 19:47:53

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


samth
2017-4-21 19:48:22

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


abmclin
2017-4-21 19:49:16

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


abmclin
2017-4-21 19:49:32

samth
2017-4-21 19:49:33

ok


samth
2017-4-21 19:49:49

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


asumu
2017-4-21 20:22:06

@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.


samth
2017-4-21 20:22:20

weird


samth
2017-4-21 20:22:30

@asumu do you get the same thing when installing?


asumu
2017-4-21 20:22:32

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


asumu
2017-4-21 20:27:48

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


mflatt
2017-4-21 20:30:47

@abmclin How about raco pkg config -i?


abmclin
2017-4-21 20:37:51

abmclin
2017-4-21 20:38:16

running echo $PLTCONFIGDIR doesn’t return any output


abmclin
2017-4-21 20:39:42

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?


samth
2017-4-21 20:56:36

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


stamourv
2017-4-21 20:58:54

stamourv
2017-4-21 21:00:17

Did you do git pull —tags since 6.8?


stamourv
2017-4-21 21:00:32

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


asumu
2017-4-21 21:01:03

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


asumu
2017-4-21 21:01:40

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


samth
2017-4-21 21:02:32

@stamourv dammit, git


asumu
2017-4-21 21:03:31

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


samth
2017-4-21 21:03:49

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


stamourv
2017-4-21 21:04:26

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


samth
2017-4-21 21:04:33

I’ll do it


samth
2017-4-21 21:04:42

just letting you know if you wanted to do it now


samth
2017-4-21 21:48:02

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


samth
2017-4-21 22:00:29

@stamourv also, I did all the remaining automated tests


stamourv
2017-4-21 22:20:33

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


samth
2017-4-21 22:20:38

I did


stamourv
2017-4-21 22:20:42

Good.


samth
2017-4-21 22:21:08

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


stamourv
2017-4-21 22:21:55

Good point.


abmclin
2017-4-21 22:46:26

@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.