Fork me on GitHub
#clojure
<
2020-07-22
>
Edmund07:07:26

Hi all. Is there a library I can use to dynamically generate DDL queries? I'm using MSSQL Express (I have to). I've looked at honeysql but it seems its meant for DML queries.

p-himik08:07:33

You can extend it to support any type of queries.

koma09:07:40

Hi, I have a design question in general. When you implement a protocol to a existing type, what is the better way to handle nil? I choose to implement the protocol to handle it, but is this a good way?

vemv11:07:49

I guess that the alternative is extend-type Object (they're not the same) Maybe I'd consider extend-type Object cleaner, because generally a nil reference represents a bug elsewhere, which I would better prevent with other tools (e.g. something similar to a type system)

koma12:07:31

@U45T93RA6 Thanks for your suggestion. I'll try it!

sandbags12:07:41

I'm building a tuple space service. I've implemented the "tuple space" bit now I need to figure out how to provide a service. A few years ago when I was doing Clojure last I would probably have reached for Liberator and made it a RESTful web service but I am wondering what whether that is still a good pattern. Maybe there are other, better, options than REST web service that exist now, any thoughts?

the2bears15:07:28

Cool, early on in my career I worked with JINI and JavaSpaces. Have always thought what a more "modern" tuple space might look like.

sandbags16:07:00

I got to play with Javaspaces and IBM T-Spaces for a while, what's shocking is that it's almost all gone. Links broken, stuff disappeared.

sandbags16:07:21

I'm not sure what I am doing is essentially very "modern" 🙂

sandbags16:07:58

I'm building it to act as the collaboration layer for a Mac app I've been building, allowing local agents to communicate with each other

sandbags16:07:18

I looked at building some kind of tightly woven-collaborative layer using Parse as a backend and then remembered using Tuple Spaces and thinking how interesting it could be. In particular the way you could easily pipe data from other services into a space to have it consumed by an agent

chrisblom12:07:59

you want to make it a REST service, or something else?

sandbags12:07:16

Not necessarily no, I am wondering what kinds of things people are using to build services these days.

sandbags12:07:58

I've tried to improve my question to be clearer what I am asking.

ordnungswidrig13:07:03

GraphQL is the newest thing. It depends on the use case. I’m a big fan of HTTP (and thus REST). (Disclaimer: liberator’s author speaking)

sandbags13:07:26

Hi Philipp. Thanks. I don't perceive GraphQL to be a good fit here because my data is flat tuples. It would be natural for me to use HTTP/Liberator and the interface is very simple. Maybe that's the easiest route. What web stack do you tend to use these days?

ordnungswidrig13:07:41

It depends. Naturally liberator or lacinia. I like pedestal as the underlying http server.

sandbags14:07:24

I'll take a look at pedestal, thanks

sandbags14:07:30

Okay this looks idea, thanks

sandbags17:07:18

@U054UD60U the Liberator tutorial starts with ring & compojure — I am assuming that Pedestal changes this picture somewhat?

ordnungswidrig17:07:38

Yes indeed. But you can use any ring handler function with pedestal. Liberator resource are ring handler functions in the end.

sandbags19:07:13

Ah, ok. Good to know, thanks.

sandbags22:07:43

@U054UD60U one question. A tuple space operation may block, waiting for a matching tuple. Now I can implement block in the client by polling the server but that feels like the wrong approach. Feels like the wrong pattern. Does that detail change your view?

ordnungswidrig06:07:54

hmmm, so HTTP supports long running requests but beware of timeouts. Maybe Server-Send Events is what you’re looking for. Supported by pedestal with async and liberator can generate them, too

sandbags08:07:38

Interesting, I had never come across these before. Thanks for the pointer.

coby15:07:51

Is there a way in clojure.test to get fixtures (a la use-fixtures) to run between each (testing ...) form and not just each deftest?

vemv15:07:51

This is something I wanted in the past (I even created an issue for it in clj's jira), but the answer is no, you can't. (A couple years later, I don't want this anymore... I like testing merely as an informative marker) But you can implement your own testing with its own fixture system (which may complement c.t's one)

3
coby18:07:37

Makes sense. I assumed as much and restructured my tests to use separate deftests.

Alex Miller (Clojure team)15:07:47

no, it's on test function granularity