<div dir="ltr">It is extremely unlikely that out of date .zo files could cause this, altho it is, in theory, possible. <div><br></div><div>Robby</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 23, 2013 at 7:55 PM, Erik Pearson <span dir="ltr"><<a href="mailto:erik@adaptations.com" target="_blank">erik@adaptations.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Robby, a nice teaching gift.<div><br><div>I think the problem has "gone away". Realizing my ad-hoc test was run from the file in which url triggers the error, I set about to embed the test in the file / dr racket window that generates url.</div>
<div><br></div><div>I ran a test function, starting very simple and step by step getting closer to the one which fails, but was unable to trigger the error. Finally I returned to the original function, and now I can't trigger the error with it either, even with all the test code removed.</div>
<div><br></div><div>Could it have been a stuck compiled file? Overwritten finally when I was running the tests? I see that my Dr Racket's "Populate 'compiled' directories" is enabled. From my CL days, if I ran into something like this I might blow away all the compiled files and recompile everything from scratch.. Anyway it works now and I'm back to working on the real problems ...</div>
<div><br></div><div>Thanks again for all the lightening fast help!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Erik.</div>
</font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 23, 2013 at 4:58 PM, Robby Findler <span dir="ltr"><<a href="mailto:robby@eecs.northwestern.edu" target="_blank">robby@eecs.northwestern.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Since there's little background here, I thought I'd just add that this feature you're coming across is one of the critical things that underpins Racket and differentiates it from languages like python and ruby. That is, what you're seeing is that Racket has a way to make unforgeable values. This ability is (in addition to lots of stuff, notably macros) is what makes it possible for Racket's class system to be a library and lots of other things that you'd expect to be built into a language to also be libraries. <div>
<br></div><div>As a little example, if you have these files:</div><div><br></div><div>;; a.rkt</div><div>#lang racket</div><div><div>(struct url (stuff more-stuff))</div></div><div><br></div><div>;; b.rkt</div><div>#lang racket</div>
<div>(struct url (stuff more-stuff))</div><div><br></div><div>;; c.rkt</div><div>#lang racket</div><div>(require (prefix-in a: "a.rkt") (prefix-in b: "b.rkt"))</div><div>(b:url-stuff (a:url 1 2))</div>
<div><br></div><div><br></div><div>you'll see an error message very similar to the one you reported.</div><div><br></div><div>It is the struct declaration's location (technically when it is evaluated -- you can even stick them inside functions and each time you call the function you get a different notion of "url") that determines which is which.</div>
<div><br></div><div>This is why, for example, you cannot see the hidden stuff inside the class and object structs. Or, for that matter functions! The "lambda" that #lang racket exports is a lot fancier than the low-level built-in lambda, and that is all implemented with structs. Indeed, you cannot tell what is primitive and what is implemented with a struct in some private file (unless you read the source code). Or, to put it another way: everything is implemented with struct and the runtime system is just good at optimizing a small subset of the structs where performance matters.</div>
<div><br></div><div>Robby</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 23, 2013 at 5:38 PM, Erik Pearson <span dir="ltr"><<a href="mailto:erik@adaptations.com" target="_blank">erik@adaptations.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>On Wed, Oct 23, 2013 at 3:31 PM, Jay McCarthy <span dir="ltr"><<a href="mailto:jay.mccarthy@gmail.com" target="_blank">jay.mccarthy@gmail.com</a>></span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here are two ideas.<br>
<br>
1) You simply have an old use of the original net/url. When #<url> is<br>
printed, it uses the symbolic name and you can't really figure out<br>
what the underlying code came from. I would do a grep to make sure<br>
this is not the case.<br></blockquote><div><br></div></div><div>Would the operative places to look be the point at which the url object is created and then where it is used? In other words, if it is created in the context of net/url (i.e. a module where net/url is required) and used in a module with adaptnet/url required, it will look like a #<url> (when printed) but not be a url? according to adaptnet/url's url-structs, and where the object travels in between doesn't make a difference?</div>
<div><div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2) You are using namespaces somewhere and actually have two instances<br>
of the same module somewhere where a value produced by copy 1 is going<br>
to copy 2. This is possible with the Web server if you don't set up<br>
the servlet namespace properly:<br>
<br>
<a href="http://docs.racket-lang.org/web-server-internal/dispatch-servlets.html#(part._namespace)" target="_blank">http://docs.racket-lang.org/web-server-internal/dispatch-servlets.html#(part._namespace)</a><br>
<br>
On Wed, Oct 23, 2013 at 4:25 PM, Erik Pearson <<a href="mailto:erik@adaptations.com" target="_blank">erik@adaptations.com</a>> wrote:<br>
> Excuse my poor experience with contracts, this is probably an easy one.<br>
><br>
> I'm using a copy of net/url and have a strange problem. The copied library<br>
> is working fine in general, but this problem cropped up today:<br>
><br>
> struct:exn:fail:contract:blame url-port: contract violation<br>
> expected: url?<br>
> given: #<url><br>
> in: the 1st argument of<br>
> (-> url? (or/c #f number?))<br>
> contract from:<br>
> /home/epearson/work/racket/github/adaptnet/url-structs.rkt<br>
> blaming: /home/epearson/work/racket/github/racqueb/httpc.rkt<br>
> at: /home/epearson/work/racket/github/adaptnet/url-structs.rkt:4.28<br>
><br>
> The error is thrown in my usage of url-port which is being passed a<br>
> perfectly good url struct object. The file is requiring the copied<br>
> url-structs. If I play with the function that is being blamed in httpc.rkt<br>
> via the repl in dr racket, this specific error is not thrown. The call to<br>
> (url-port url) succeeds without throwing this contract exception.<br>
><br>
> From my primitive understanding, I'm flummoxed: Why is a #<url> not a url?<br>
><br>
> I suspected that there may have been a leftover require of net/url confusing<br>
> things, but I can't find any in my code.<br>
><br>
> Using racket head from github 5.90.0.9--2013-10-20(d6610289/d)<br>
><br>
> Help!<br>
><br>
> Thanks,<br>
> Erik.<br>
><br>
><br>
><br>
> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
<span><font color="#888888"><br>
<br><span><font color="#888888">
<br>
--<br>
Jay McCarthy <<a href="mailto:jay@cs.byu.edu" target="_blank">jay@cs.byu.edu</a>><br>
Assistant Professor / Brigham Young University<br>
<a href="http://faculty.cs.byu.edu/~jay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br>
<br>
"The glory of God is Intelligence" - D&C 93<br>
</font></span></font></span></blockquote></div></div></div><span><font color="#888888"><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Erik Pearson<br>Adaptations<br>;; web form and function
</font></span></font></span></div></div><span><font color="#888888">
<br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></font></span></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Erik Pearson<br>Adaptations<br>;; web form and function
</div>
</div></div></blockquote></div><br></div>