samth
2017-2-3 11:51:41

@mflatt further investigation of the launcher issue suggests that it’s this code that’s wrong: https://github.com/racket/racket/commit/572b96a6efc4dcb6c4e00fd4abeaedcae5eae868#diff-7a63c515d4e7d5db783c3786ebd72110R473


samth
2017-2-3 11:51:55

In particular, it generates this line in the shell script:


samth
2017-2-3 11:52:12
# {{{ librktdir
librktdir="$bindir/../../home/samth/sw/plt/racket/lib"
# }}} librktdir

samth
2017-2-3 11:52:30

which includes an absolute path inside the relative path


samth
2017-2-3 12:22:02

I don’t understand why that code is trying to generate something relative to dest, since it’s then used relative to $bindir


mflatt
2017-2-3 14:18:33

@samth I think you’re right that I made the wrong change there, and your patch is the right repair as far as I can tell


jaz
2017-2-3 14:53:23

@jaz has joined the channel


dstorrs
2017-2-3 15:05:12

@leafac I’ve been using http://Glip.com\|Glip.com for a project for a while now. It’s free, has no history limit that I’m aware of, supports links, supports at least as much Markdown as Slack does, and allows uploading files with preview. If you link to a Google Docs you can even edit in inline.


dstorrs
2017-2-3 15:05:22

(I have no association with the company)


leafac
2017-2-3 15:18:31

@dstorrs: Nice. I didn’t know about Glip. Thanks for the suggestion. (But, contrary to what Racket team is doing, for the stuff I administer, I’m trying to move away from SaaS and self-host everything I can. Mainly because of the “if you’re not the customer, you’re the product” thing; I want the Internet to be as decentralized as possible. Specially in the weird times in which we live.)


dstorrs
2017-2-3 15:25:25

> Specially in the weird times in which we live.

Preach it.


samth
2017-2-3 15:27:21

@leafac While I understand that impulse, it’s hard to maintain something large-scale with the same reliability as something like GitHub or slackbot


samth
2017-2-3 15:27:35

as we saw with the outage of several Racket services over new years


samth
2017-2-3 15:28:16

also, there are advantages of Slack beyond just hosting, since people know it, it has good mobile apps, etc


leafac
2017-2-3 15:34:20

I agree. Just because I want to do this for the services I administer, it doesn’t mean I want everyone to do the same :slightly_smiling_face:


leafac
2017-2-3 15:37:42

Same thing with licenses, too. Just because I use GPL for my personal projects, doesn’t mean I wouldn’t happily sign the relicensing permission to move Racket to MIT/Apache 2 (https://github.com/racket/racket/issues/1570#issuecomment-271853248) :slightly_smiling_face:


bill_temps
2017-2-3 16:20:38

“I want the Internet to be as decentralized as possible. Specially in the weird times in which we live.” Also agree. “When the going gets weird, the weird turn pro.”


samth
2017-2-3 16:23:46

@bill_temps the valence of the latter line seems ambiguous these days …


pocmatos
2017-2-3 16:40:25

Can someone recommend an example of a project that’s using rackunit on a large scale? I would like to see how certain things are automated, like running all tests in a project automatically, or just specific tests, or how to best define objects to be initialized before a testcase runs.


samth
2017-2-3 16:41:27

@pocmatos Typed Racket uses Rackunit extensively, see here: https://github.com/racket/typed-racket/tree/master/typed-racket-test


samth
2017-2-3 16:42:17

syntax-parse uses it here; that might be easier to follow: https://github.com/racket/racket/tree/master/pkgs/racket-test/tests/stxparse


pocmatos
2017-2-3 16:42:59

@samth thanks, that’s useful.


nlightnfotis
2017-2-3 20:54:28

Is floating point arithmetic more reliable in Racket than other languages?


nlightnfotis
2017-2-3 20:55:18

I mean, the same 3 multiplications give me the following results:


nlightnfotis
2017-2-3 20:55:31

javascript: 0.15 0.50 0.35


nlightnfotis
2017-2-3 20:55:38

racket: 0.16 0.48 0.36


stamourv
2017-2-3 20:56:32

nlightnfotis: For float-only operations, Racket should just use your CPU’s floating point operations, as I’d expect JS would.


stamourv
2017-2-3 20:56:48

Could you share the programs you’re using? Possibly on pasterack?


nlightnfotis
2017-2-3 21:00:08

stamourv Sure


nlightnfotis
2017-2-3 21:00:13

Here is the racket program


nlightnfotis
2017-2-3 21:00:33

nlightnfotis
2017-2-3 21:00:38

And here is the js


nlightnfotis
2017-2-3 21:00:43

nlightnfotis
2017-2-3 21:01:25

I am always open to suggestions on how to make it better, I’m still a newbie as far as Racket is concerned


nlightnfotis
2017-2-3 21:01:38

I mean, if you see something that could be more idiomatic


nlightnfotis
2017-2-3 21:05:31

Oh, and I forgot to mention that I run it on racket v6.6 and node v6.9.1


stamourv
2017-2-3 21:08:42

nlightnfotis: Well, the main difference I see between the two is that your JS code explicitly rounds intermediate results by calling _round_number. That could have an effect.’


lexi.lambda
2017-2-3 21:08:45

@nlightnfotis: the JS one seems to be explicitly rounding numbers in _next_gen, which would explain a loss of precision


lexi.lambda
2017-2-3 21:08:55

oops, Vincent beat me to it :)


stamourv
2017-2-3 21:09:10

:)


nlightnfotis
2017-2-3 21:10:23

Okay. But is the rounding in _next_gen enough to cause the discrepancies in the results?


nlightnfotis
2017-2-3 21:11:05

I mean, the js version without the rounding would still produce 0.150000004 or something to that effect, while the racket version still produces 0.160000003


nlightnfotis
2017-2-3 21:12:01

Am I right on that?


nlightnfotis
2017-2-3 21:14:12

Ahh, okay, I checked it out.


nlightnfotis
2017-2-3 21:14:52

It seems that without the rounding they both report the same numbers


lexi.lambda
2017-2-3 21:29:42

@robby: I’m currently trying to fix https://github.com/racket/racket/issues/1412, and the more I look at it, the more I’m convinced the current default is the wrong one. Even the example in the syntax/parse docs should really have the blame swapped. http://docs.racket-lang.org/syntax/exprc.html


lexi.lambda
2017-2-3 21:30:58

However, I’m unsure if just swapping the blame for wrap-expr/c is good enough, since I guess someone could theoretically want the current blame. What would be a decent way of exposing that choice to a user? Just including a boolean keyword argument called #:blame-swap? seems pretty vague, but I’m having trouble coming up with a better name.


lexi.lambda
2017-2-3 21:32:13

I originally tried adding a #:use-style keyword argument that could be 'binding or 'expression, but that doesn’t really make sense, since what really matters is which party is responsible for providing the contract relative to the party providing the expression.


robby
2017-2-3 21:34:37

I’m not really sure how expr/c is meant to be used but unless there is a clear notion of a boundary between two different parties, it will be hard to make this work. You would need to start there — where is the boundary and how can you get the names of the two parties on the opposite sides of the boundary?


lexi.lambda
2017-2-3 21:39:37

Well, in my opinion, the user’s perspective of the boundary is usually extremely similar to the boundary formed by assigning an arrow contract to a function. In my case, I have a macro that implements some SQL-y syntax, and one of the inputs should satisfy a sql-expression? contract. When a user writes this: (select from t where some-pred) …then some-pred is, in the mind of the user, just like an argument to a function, even though select is a macro. If some-pred turns out to be 3, then a contract violation should be signaled where select itself is the negative party. (I think, at least, I sometimes get which party is the negative one and which one is the positive one confused.)


lexi.lambda
2017-2-3 21:43:09

@robby: One of the key issues here, though, is that the error message for a contract violation uses blame-swapped? to decide whether or not to include a “broke its own contract” error message. Just changing the parties in the use of contract that expr/c expands to does not change blame-swapped?.


robby
2017-2-3 21:43:43

that is correct.


robby
2017-2-3 21:43:49

And, I believe, the correct behavior.


robby
2017-2-3 21:44:14

swapping the arguments means that yoru broundary starts out hte other way, not that self-blame happened.


lexi.lambda
2017-2-3 21:44:22

I agree. It just means that the current behavior of expr/c will always produce a “broke its own contract” message, which I think is wrong.


robby
2017-2-3 21:45:10

I think that expr/c needs to establish a notion of boundary and I don’t see how it has the right information to do that (maybe it does and I just dno’t get it tho). without that, it isn’t clear how best to proceed.


lexi.lambda
2017-2-3 21:46:33

I’m not sure that’s the issue here? Though obviously you know much more about this than I do so I am likely wrong. :) From my point of view, though, in the select macro from above, the sql-expression? contract applied to some-pred is semantically like a contract used in the domain of an arrow contract; that is, its blame would normally be swapped during the contract’s projection.


lexi.lambda
2017-2-3 21:48:49

But because expr/c just attaches the contract directly, that never happens. An easy hack to change this is to write a (possibly naughty) contract combinator that swaps the blame: (define (blame-swapped/c ctc) ((cond [(flat-contract? ctc) make-flat-contract] [(chaperone-contract? ctc) make-chaperone-contract] [else make-contract]) #:name (contract-name ctc) #:first-order (contract-first-order ctc) #:projection (λ (blame) ((contract-projection ctc) (blame-swap blame))) #:stronger (λ (x y) (contract-stronger? ctc y)) #:list-contract? (list-contract? ctc))) This produces the right error message because expr/c uses information from the source location of the syntax object provided as well as syntax-local-context to establish which parties are involved, and the blame gets swapped to match the idea that this contract is a part of the macro’s domain.


lexi.lambda
2017-2-3 21:49:30

This is obviously pretty hacky, though. Am I committing some gross atrocity against the contract system by doing that sort of thing?


robby
2017-2-3 21:51:47

I don’t think that’s quite the right approach. In the acse of the select macro, I’d say that hte two parties are probably the runtime code that it expands into a calls to and the module where select appears. If you put those two names into the two positions, do you get good error messages? If not, then I think a change to expr/c is in order.


robby
2017-2-3 21:51:57

Probably writing blame-swapped/c isn’t a good route.


lexi.lambda
2017-2-3 22:02:01

@robby: Not really. Let me give an example. Consider this simplified, contrived piece of code: (define-simple-macro (use-integer {~var x (expr/c #'integer? #:name "1st argument" #:positive 'use-site #:negative "use-integer/proc")}) (use-integer/proc x.c)) (define (use-integer/proc x) (add1 x)) > (use-integer "hi") 1st argument of use-integer: broke its own contract promised: integer? produced: "hi" in: integer? contract from: anonymous-module blaming: anonymous-module (assuming the contract is correct) at: unsaved-editor:28.13 Note the “broke its own contract” error message. Compare the alternative using the blame-swapped/c hack: (define-simple-macro (use-integer {~var x (expr/c #'(blame-swapped/c integer?) #:name "1st argument" #:positive "use-integer/proc" #:negative 'use-site)}) (use-integer/proc x.c)) (define (use-integer/proc x) (add1 x)) > (use-integer "hi") 1st argument of use-integer: contract violation expected: integer? given: "hi" in: integer? contract from: anonymous-module blaming: anonymous-module (assuming the contract is correct) at: unsaved editor:28.13


lexi.lambda
2017-2-3 22:02:30

(Maybe a bad example because the macro and the use are being used in the same module. I should try it again with them in separate modules to get more illustrative error messages.)


robby
2017-2-3 22:02:37

I think I must be being clear. If we don’t start from a clear definition of the boundaries, then there are no answers.


robby
2017-2-3 22:03:06

Deciding who to blame for a contract violation where you don’t have an “us” and “them” on the opposite sides of the contract makes no sense.


lexi.lambda
2017-2-3 22:03:28

The boundary here is effectively between the macro and the macro user.


robby
2017-2-3 22:03:28

(I left off a “not” in the “I think …” line. sorry)


robby
2017-2-3 22:04:22

The boundary needs to have some (ideally syntactic) manifestation in the program. Eg, between two modules. Or between the body of a definition and the rest of the module it contains.


robby
2017-2-3 22:04:46

So “the macro” doesn’t really count, since the macro is gone by the time the program runs and the contracts are checked.


robby
2017-2-3 22:04:59

Or, perhaps, I am missing some way to thnk o that as a boundary?


lexi.lambda
2017-2-3 22:06:18

Is that a requirement, though? Each party still has a precise source location. The macro can use that information to collect enough info to create a meaningful boundary, even if there isn’t an obvious place in the runtime program where you can point to and say “here’s the boundary”.


robby
2017-2-3 22:06:57

I dunno if it is a requirement. I am just saying that without a boundary I don’t know how to design a contract system.


robby
2017-2-3 22:07:27

Maybe the boundary is the enclosing module of the use of the macro and the enclosing module of the definition of the macro?


lexi.lambda
2017-2-3 22:08:29

Yeah, I think that’s what I’m getting at, even if I don’t really have a firm grasp on the formal model. :) At least, that’s what the implementation of expr/c currently assumes.


lexi.lambda
2017-2-3 22:19:05

@robby: Is there a reason the macro itself cannot be a party like a function can be a party?


robby
2017-2-3 22:19:32

The function isn’t a party. :slightly_smiling_face:


robby
2017-2-3 22:19:41

oh— unless you’re talking about define/contract?


lexi.lambda
2017-2-3 22:20:09

I am, yes.


robby
2017-2-3 22:20:19

define/contract is a shorthand for with-contract really. And that establishes the boundary at the expression level.


robby
2017-2-3 22:20:39

Ie, things inside this “pair of parens” vs outside this pair of parens.


robby
2017-2-3 22:20:43

Sure, you could do something like htat.


robby
2017-2-3 22:21:40

I think modules are a better unit to choose for most things (it is less confusing when there are no free variables and the error messages make more sense and it seems to ust generally fit better with how we develop code) but it isn’t necessary


robby
2017-2-3 22:22:16

In the code fragment above, I don’t see “use-integer/proc” or “use-sit” showing up in the messages, so I’m not sure what to make of it.


robby
2017-2-3 22:22:30

(I have to go now, sorry)


lexi.lambda
2017-2-3 22:23:04

No worries. This has given me stuff to think about, so I’ll keep trying some things. I think this has helped my understanding, though, so thank you.


lexi.lambda
2017-2-3 22:23:42

(And for what it’s worth, 'use-site is specially handled by expr/c and basically turns into (quote-module-source).)