Re: Thoughts on clojure.spec

2016-07-12 Thread Maarten Truyens
I would also truly appreciate instrumentation of function outputs for 
manual outputs. I understand the rationale for not having it as the 
default, but could it perhaps be specified as an option s/instrument? 
(Considering that it was present in the first alphas, I would assume that 
such option should not be far-fetched.)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How I can access protected field of superclass from my generated by "gen-class" subclass?

2016-07-12 Thread Roc King
(ns demo.protectedfield
  [:gen-class
   :extends clojure.lang.ARef
   :exposes {validator {:get getvalidator :set setvalidator}}])

Is this what you are looking for?
After compile, you will get a class that extends clojure.lang.ARef

(compile 'demo.protectedfield)
(instance? clojure.lang.ARef (demo.protectedfield.))

and has a pair of public getter/setter.

(require '[clojure.reflect :refer [reflect]])
(->> (reflect demo.protectedfield)
  :members (filter (comp '#{getvalidator setvalidator} :name)))

({:name getvalidator,
  :return-type clojure.lang.IFn,
  :declaring-class demo.protectedfield,
  :parameter-types [],
  :exception-types [],
  :flags #{:public}}
 {:name setvalidator,
  :return-type void,
  :declaring-class demo.protectedfield,
  :parameter-types [clojure.lang.IFn],
  :exception-types [],
  :flags #{:public}})

Or, as the last resort, use reflection:

(defn field [^Class c name]
  (let [field (doto (.getDeclaredField c name) (.setAccessible true))]
(fn
  ([] (.getType field))
  ([x] (.get field x))
  ([x v] (.set field x v)

(def validator
  (field clojure.lang.ARef "validator"))

Now, *validator* could get and set the corresponding protected field of 
clojure.lang.ARef:

(def forbid (constantly false))
(def permit (constantly true))

(let [v (atom 0)]
  (assert (nil? (get-validator v)))
  (assert (nil? (validator v)))
  (validator v permit)
  (assert (identical? permit (get-validator v)))
  (assert (identical? permit (validator v

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible / is support planned to add docstrings to clojure.spec specs?

2016-07-12 Thread Radford Smith
This seems like a useful addition. Is this something that could be included 
in Clojure 1.9?

On Wednesday, June 1, 2016 at 11:39:12 PM UTC-7, Russell wrote:
>
> Just been trying out clojure.spec for the first time, looks really nice. 
> It would be good to be able to do something like the following:
>
> (clojure.spec/def
>   "The name of the stage, which API Gateway uses as the first path segment 
> in the invoke Uniform Resource Identifier (URI)."
>   :aws.apigateway.stage/StageName string?)
>
> ...so useful information not expressible in the spec itself can be 
> included in a docstring so that it can be picked up by tooling, 
> clojure.repl/doc etc. From what I can see of the code it doesn't look 
> like this is currently possible: is this something that is likely to be 
> added?
>
> Thanks,
>
> Russell
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible / is support planned to add docstrings to clojure.spec specs?

2016-07-12 Thread Alex Miller
It's under consideration.

On Thursday, June 2, 2016 at 1:39:12 AM UTC-5, Russell wrote:
>
> Just been trying out clojure.spec for the first time, looks really nice. 
> It would be good to be able to do something like the following:
>
> (clojure.spec/def
>   "The name of the stage, which API Gateway uses as the first path segment 
> in the invoke Uniform Resource Identifier (URI)."
>   :aws.apigateway.stage/StageName string?)
>
> ...so useful information not expressible in the spec itself can be 
> included in a docstring so that it can be picked up by tooling, 
> clojure.repl/doc etc. From what I can see of the code it doesn't look 
> like this is currently possible: is this something that is likely to be 
> added?
>
> Thanks,
>
> Russell
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] http-kit 2.2.0 final is out

2016-07-12 Thread Oliver Hine
This is awesome work, thank you to you and all the contributors.

On Tuesday, 12 July 2016 07:55:09 UTC+1, Peter Taoussanis wrote:
>
> On Clojars, and GitHub at: https://github.com/http-kit/http-kit/releases
>
> This release was put together with the help of (23!) individual 
> contributors.
>
> Enjoy, cheers! :-)
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] pedestal-api 0.3.0 release - better Swagger compliance

2016-07-12 Thread Oliver Hine
Hi all,

pedestal-api is a library for building APIs on the pedestal web server. It 
implements the parts of HTTP that are useful for APIs and allows you to 
document your handlers and middleware using idiomatic Clojure and generate 
a compliant Swagger specification.

This 0.3.0 release contains improvements to compliance of the Swagger spec, 
including:

   - Ordered declarations 
   - Guaranteed provision of operationId 
   
   - Default value for basePath 
   


You can find out more on the project's Github 
page https://github.com/oliyh/pedestal-api

Cheers

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible / is support planned to add docstrings to clojure.spec specs?

2016-07-12 Thread Nils Grunwald
I would find this very interesting, especially for generating easily 
shareable documentation...

Nils

On Thursday, June 2, 2016 at 8:39:12 AM UTC+2, Russell wrote:
>
> Just been trying out clojure.spec for the first time, looks really nice. 
> It would be good to be able to do something like the following:
>
> (clojure.spec/def
>   "The name of the stage, which API Gateway uses as the first path segment 
> in the invoke Uniform Resource Identifier (URI)."
>   :aws.apigateway.stage/StageName string?)
>
> ...so useful information not expressible in the spec itself can be 
> included in a docstring so that it can be picked up by tooling, 
> clojure.repl/doc etc. From what I can see of the code it doesn't look 
> like this is currently possible: is this something that is likely to be 
> added?
>
> Thanks,
>
> Russell
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible / is support planned to add docstrings to clojure.spec specs?

2016-07-12 Thread Daniel Compton
There’s a ticket for this at http://dev.clojure.org/jira/browse/CLJ-1965 if
you want to vote/watch/comment.

On Wed, Jul 13, 2016 at 8:07 AM Nils Grunwald 
wrote:

> I would find this very interesting, especially for generating easily
> shareable documentation...
>
>
> Nils
>
>
> On Thursday, June 2, 2016 at 8:39:12 AM UTC+2, Russell wrote:
>>
>> Just been trying out clojure.spec for the first time, looks really nice.
>> It would be good to be able to do something like the following:
>>
>> (clojure.spec/def
>>   "The name of the stage, which API Gateway uses as the first path
>> segment in the invoke Uniform Resource Identifier (URI)."
>>   :aws.apigateway.stage/StageName string?)
>>
>> ...so useful information not expressible in the spec itself can be
>> included in a docstring so that it can be picked up by tooling,
>> clojure.repl/doc etc. From what I can see of the code it doesn't look
>> like this is currently possible: is this something that is likely to be
>> added?
>>
>> Thanks,
>>
>> Russell
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-- 
—
Daniel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.