Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-02-04 Thread Philip McGrath
On Sat, Feb 2, 2019 at 11:34 PM hashim muqtadir wrote: > > As long as you at least know the schema you're working with, you could > even generate select statements for all possible sets of columns at compile > time, and then just choose the right statement dynamically with a runtime > function.

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-02-02 Thread hashim muqtadir
> The issue you're encountering with namespaces is analogous, because each namespace gets its own instances of modules. This is a feature! Imagine, for example, that you are trying to run students' programs in a sandbox. If namespaces shared module instances, a malicious or buggy student

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-02-02 Thread George Neuner
On 2/1/2019 5:12 AM, hashim muqtadir wrote: > No.  Look back at your code ... you defined the struct in your own > unnamed module just before the definition of "select/f" But the thing is, the error was that it failed to recognize sql-statement in the test, which is provided by sql, not me.

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-02-01 Thread Philip McGrath
On the original question: Racket's struct types are generative (except for #:prefab structs), meaning that each time you evaluate a `struct` form (or, at a lower level, each time you call `make-struct-type`), the you create a fresh type distinct from all other types. That can be a bit confusing to

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-02-01 Thread hashim muqtadir
> Good news, limit and distinct are in scope for v0.2 - I'm working on it now :) That's good to hear, thanks! I'll be sure to check it out, and let you know if I have any ideas/requirements for features or if I can contribute. -- You received this message because you are subscribed to the

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-02-01 Thread Ryan Kramer
> > PS There's also a racket package called plisqin which seemed closer to > what I was looking for. Maybe in a few months or so if it clicks I'll see > if I can add to that package everything I need (things like limit and > distinct) and it might work out. > Good news, limit and distinct are

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-02-01 Thread David Storrs
Hey, neat. I did not know that there was a sql package; I should have thought to look. Ryan, is there a way to use PostgreSQL's "RETURNING" feature or other DB-specific items? RETURNING is insanely useful and I'd be sad to give it up. On Fri, Feb 1, 2019 at 5:12 AM hashim muqtadir wrote: > >

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-02-01 Thread hashim muqtadir
> No. Look back at your code ... you defined the struct in your own > unnamed module just before the definition of "select/f" But the thing is, the error was that it failed to recognize sql-statement in the test, which is provided by sql, not me. The function otherwise worked correctly. The

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-02-01 Thread George Neuner
On 2/1/2019 12:39 AM, hashim muqtadir wrote: > If order to use a struct across namespaces, the module that > defines the struct must be required into each namespace that uses the > struct. Yes, I suspect there's some weird interaction between namespaces too, hence the topic, but that's still

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-01-31 Thread hashim muqtadir
> If order to use a struct across namespaces, the module that > defines the struct must be required into each namespace that uses the > struct. Yes, I suspect there's some weird interaction between namespaces too, hence the topic, but that's still pretty vague. After all, the thing defining

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-01-31 Thread George Neuner
On 1/31/2019 10:58 AM, hashim muqtadir wrote: The test in my following code raises an error saying that when I call select/f, the result doesn't satisfy `sql-statement?`. I've no idea why, the only vague idea I have is that it may have something to do with the fact that it was essentially

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-01-31 Thread 'John Clements' via Racket Users
First off, many thanks for bringing to my attention the fact that Ryan has started racket-izing SQL! And thanks, Ryan, for racket-izing SQL! Maybe I can stop stapling together all of those long horrible strings now. Next, to answer your question, I believe that eval is not necessary here, and

[racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-01-31 Thread hashim muqtadir
Hello, The test in my following code raises an error saying that when I call select/f, the result doesn't satisfy `sql-statement?`. I've no idea why, the only vague idea I have is that it may have something to do with the fact that it was essentially eval'd in a separate namespace. Any ideas?