google-cloud

Google Cloud Platform: Clojure + {GAE, GCE, anything else on Google Platform}
2017-01-17T18:30:06.000283Z

@nickbauman re: hooks, deftype and defrecord also support java annotations.

✅ 1
nickbauman 2017-01-17T18:58:49.000284Z

@mobileink do you support hooks?

nickbauman 2017-01-17T18:59:22.000285Z

https://github.com/nickbauman/cljgae-template/issues/15

nickbauman 2017-01-17T19:01:14.000287Z

I’m currently using defrecord in the defentity macro so in theory I could use those features, but I want to underlying implementation to be free of the defrecord macro so that if desired, the user can choose to forgo the defentity macro and work with pure maps.

nickbauman 2017-01-17T19:17:27.000288Z

Does that make any sense, mobileink ?

2017-01-17T21:41:12.000289Z

you want to associate callbacks with entities?

2017-01-17T21:57:27.000290Z

@nickbauman my reading of the cb api is you don't need to do that.

nickbauman 2017-01-17T21:57:48.000291Z

right you just register them.

nickbauman 2017-01-17T21:58:08.000292Z

But I don’t want to rely on defrecord

nickbauman 2017-01-17T21:58:17.000293Z

I’m thinking of just using genclass

2017-01-17T22:12:11.000294Z

what's the advantage of gen-class? it's useless if you don't aot. I'm not sure since I haven't implemented yet, but I suspect you could just provide some sample code demonstrating the use of deftype. I don't think it needs to be part of your api/dsl. just guessing.

nickbauman 2017-01-17T22:33:01.000295Z

I’m confused. I thought the javadocs said that an annotation is required to support hooks.

nickbauman 2017-01-17T22:34:19.000296Z

I’m pretty sure everything going up on appengine requires full AOT

2017-01-17T22:46:36.000297Z

yes, it's the annotation that make a method a callback. no, it is not the case that "everything" must be at compiled. only the servlets and filters.

2017-01-17T22:47:49.000298Z

having said that, I'm not sure about callbacks, not having implemented them. I'm assuming they only need the annotation, not aot. I could be wrong on that.

2017-01-17T22:53:16.000299Z

iow, you only have to aot compile the stubs, not the clojure code that implements you business logic. when the servlet container calls a method in your stub, the gen-class code forward the call to your clojure code. this is explained in a little more detail at https://github.com/migae/boot-gae. the did is relatively extensive but not very well organized. working on it.

2017-01-17T22:55:04.000301Z

goddammit I hate android spell check, which continually rewrites my text into sth illiterate.

nickbauman 2017-01-17T22:56:57.000302Z

lol

nickbauman 2017-01-17T22:57:27.000303Z

I wasn’t aware that you can compile at runtime on AE at all?

nickbauman 2017-01-17T23:00:57.000304Z

I wonder if writing the callbacks in pure clojure would be easier lol

nickbauman 2017-01-17T23:01:05.000305Z

Not even using their crappy annotations.

2017-01-17T23:02:01.000306Z

well, define "compile". clojure compiles, always. it's not an interpreter. aot compilation just puts the byte code on disk, which the servlet container needs in order to find and load.

nickbauman 2017-01-17T23:02:09.000307Z

IN java you have to use annotation to do what’s trivial in Clojure because Java is too crude.

nickbauman 2017-01-17T23:02:35.000308Z

Right OK

2017-01-17T23:05:22.000309Z

check out the "servlets" task in migae. it reads an end file that contains servlet specs, generates a clojure source file with a gen-class for each servlet, aot compiles it, then discards it. the app code need only implement the service method for each servlet - in clojure.

nickbauman 2017-01-17T23:05:45.000310Z

huh

2017-01-17T23:05:59.000311Z

reads an edn file, not end.

nickbauman 2017-01-17T23:06:09.000312Z

right

2017-01-17T23:14:17.000313Z

so boot-migae depends critically on the boot task pipeline; i can do all that stuff independently. not sure how feasible that is with leinengen.

2017-01-17T23:33:30.000314Z

callbacks in pure clojure: looks doable to me. servlet container needs web.xml plus on-disk bytexode to find and load servlets. ds callbacks need only annotations. this is an appengine datastore convention, the servlet container need not be involved - i think. when the appengine runtime goes to call a callback, does it need to find it on disk? doubt it but dunno.