mark.warren
2018-9-6 09:15:02

Floating point numbers are notoriously ‘inaccurate’ as they are an approximation and so using equality with them is very hit and miss. See https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html for a full explanation.


ryanc
2018-9-6 09:55:48

@gregor.kiczales for the teaching languages, DrRacket sets the read-decimal-as-inexact parameter to false (I don’t know the details how the teaching languages are mapped to reader settings, though, sorry). If you’re are feeding the sandbox evaluator text, then I would expect a sandbox set up for the teaching languages to have the right reader settings already. But if you’re feeding the evaluator S-expressions (or syntax objects), it’s probably already too late; the numbers have already been read using the enclosing environment’s rules, which default to inexact numbers.


maxsnew
2018-9-6 14:01:41

maxsnew
2018-9-6 14:02:40

What exactly is going on here? Is it that the value of json-null in the type of JsonExpr is determined when you require it? Or when you define the module?


samth
2018-9-6 14:03:44

@maxsnew the code for typed/json pretends that json-null doesn’t exist, and that thus null in json is always translated to 'null in Racket


samth
2018-9-6 14:04:24

of course, that’s not right, and so you can make string->json produce values that don’t fit the JSExpr type it’s supposed to have


samth
2018-9-6 14:04:50

which triggers a contract error, similar to if the type for JSExpr was String or something else totally wrong


maxsnew
2018-9-6 14:04:57

these types are trusted?


samth
2018-9-6 14:05:00

no


maxsnew
2018-9-6 14:05:18

sorry I meant is this ordinary typed racket code? Why does it type check?


maxsnew
2018-9-6 14:05:30

Is it because you just “ann” some untyped code?


samth
2018-9-6 14:06:00

fundamentally the issue is the same as if you write (require/typed racket/base [string->number (-> String String)])


maxsnew
2018-9-6 14:06:18

right so it’s not really typed code


samth
2018-9-6 14:06:30

typed/json is typed code


maxsnew
2018-9-6 14:06:56

But it’s just a require and provide essentially?


samth
2018-9-6 14:07:07

yes


maxsnew
2018-9-6 14:07:27

ok so I don’t really see what Matthias is so up in arms about


maxsnew
2018-9-6 14:07:50

could you make a version of this that worked correctly with the parameterization using typed units?


samth
2018-9-6 14:08:38

that would be a different approach to the parameterization, and I don’t think typed units support type parameterization that way


maxsnew
2018-9-6 14:08:54

right not the same library


samth
2018-9-6 14:08:57

but @dan would know better


samth
2018-9-6 14:10:06

Matthias is making two points — 1 that I don’t understand about getting around the boundary, and 2 that it’s not the untyped code’s “fault” that it failed to live up to the contract


samth
2018-9-6 14:11:04

I think the second point is about error messages and debugging approaches, rather than a formal claim


maxsnew
2018-9-6 14:12:55

agreed


maxsnew
2018-9-6 14:13:32

Also would there be some type in TR that says “precondition: #:null is ’null?”


maxsnew
2018-9-6 14:14:38

though what liberalartist just proposed is more reasonable/faithful


maxsnew
2018-9-6 14:15:13

(to what TR is doing)


maxsnew
2018-9-6 14:15:20

(typed/json rather)


samth
2018-9-6 14:16:24

it’s easy to make the type require the #:null keyword argument and require that it be the symbol 'null


samth
2018-9-6 14:16:33

but that sounds annoying to use


maxsnew
2018-9-6 14:23:34

does that mean you would always have to supply the #:null keyword?


maxsnew
2018-9-6 14:23:56

or would it “just work” if the json-null parameter is ’null?


samth
2018-9-6 14:27:11

you’d always have to supply it


samth
2018-9-6 14:27:23

TR can’t reason about the current values of parameters


maxsnew
2018-9-6 14:27:41

oh ofc duh


gregor.kiczales
2018-9-6 15:53:57

@ryanc and others. thanks, very helpful


gregor.kiczales
2018-9-6 15:55:59

I guess I had gotten used to the exact numbers of the teaching languages and somehow thought they were default in Racket.


abmclin
2018-9-6 19:35:39

question about raco pkg install --scope-dir option if I use that option, then dependency checking ignores any packages already installed under -i or -u scopes and will attempt to install the entire dependency tree of a package, including base and racket-lib even though they already are present in the installation scope. Is that intended?


mflatt
2018-9-6 20:40:17

The original intent was for a scope directory to be even more “installation” than installation – so, something like “/usr/share/.…” while installation is “/usr/local/share/….“. But the package-search configuration lets you order the directories either way. I think probably --scope-dir should pay attention the search order and look in directories later than the specified one in the search list. That would be a change to get-scope-list in “pkg-db.rkt” to use the same member-based approach as used for 'user or 'installation.


abmclin
2018-9-6 23:02:54

I think that would be a welcome change, I can take a look and see if I can make the change myself. My motivating reason was to create binary libs for a set of pkgs and their dependencies so I was hoping to be able to install the source versions and their uninstalled deps into a —scope-dir directory, and run raco pkg create —binary-lib over the installed pkgs. That approach didn’t work due to the above complication. Do you have a better suggestion?


abmclin
2018-9-6 23:04:32

Ideally I’d like to be able to take advantage of automated dependency management and avoid needing to locate each missing package to create the binary lib version from. I’m assembling a minimal Racket distribution for a particular application.


blerner
2018-9-6 23:07:02

I’ve made no further progress on this. @samth, any other info would be appreciated, though it’s not urgent


samth
2018-9-7 01:22:32

I don’t really have any further suggestions right now, I would open a bug report