I wonder why this can't become a language feature? Couldn't Clojure attach
the :source metadata directly to function objects (in addition to vars)? Is
there a JIRA ticket for it? I'd instant-vote for it because I know it would
make my debugging faster.
On Thursday, May 28, 2015 at 1:03:52 PM
Okay. Thanks BG :)
On Saturday, May 30, 2015 at 5:13:00 AM UTC+5:30, Baishampayan Ghose wrote:
May be wrap it up in a `wait-until-with-meta` macro as Herwig suggested?
Then you can search and replace the invocations. ~BG
On Fri, May 29, 2015 at 9:30 PM, Shalaka Patil sha...@helpshift.com
I see what you mean, this is nice [?]
On Thu, May 28, 2015 at 11:25 PM, Herwig Hochleitner hhochleit...@gmail.com
wrote:
2015-05-28 19:42 GMT+02:00 Mohit Thatte mohit.tha...@gmail.com:
The interesting question here is what constitutes useful information!
(let [pred #(exists? .foo)]
Hey, Thanks Herwig Mohit.
So, I have one more solution.
Here is the original wait-until function-
(defn wait-until
([pred] (wait/wait-until *driver* (fn [_] pred))) ([pred timeout] (wait/
wait-until *driver* (fn [_] pred) timeout)) ([pred timeout interval] (wait/
wait-until *driver* (fn
Hey BG,
Yes, having metadata is really a straight forward way but this is kind
of extra work in every wait-until call which I was trying to avoid. Going
with metadata option will not just cause extra work for wait-until in
future code but even I need to add it at all the places in wherever
Shalaka,
This is a really interesting conversation :-) However, I'd insist that you
ditch eval or any sort of complicated affair and adopt the metadata
approach as I had suggested that day :-P
~BG
On Fri, May 29, 2015 at 4:20 PM, Shalaka Patil shal...@helpshift.com
wrote:
Hey, Thanks Herwig
May be wrap it up in a `wait-until-with-meta` macro as Herwig suggested?
Then you can search and replace the invocations. ~BG
On Fri, May 29, 2015 at 9:30 PM, Shalaka Patil shal...@helpshift.com
wrote:
Hey BG,
Yes, having metadata is really a straight forward way but this is kind
of extra
2015-05-28 19:22 GMT+02:00 Mohit Thatte mohit.tha...@gmail.com:
Changing wait-until to a macro seems like the simplest way to tackle this.
It gives you access to pred at compile time, does not force the caller to
add meta-data to pred, and you can construct the error message as you like.
I
Hi Shalaka,
+1 to what Herwig said.
Changing wait-until to a macro seems like the simplest way to tackle this.
It gives you access to pred at compile time, does not force the caller to
add meta-data to pred, and you can construct the error message as you like.
The challenge with your approach 1
but it won't give useful information if you don't construct the op inline.
The interesting question here is what constitutes useful information! The
trade-off is breaking an existing public API.
If Shalaka's primary goal is prettier errors in test failures, I'd settle
for the fn body itself as
2015-05-28 19:42 GMT+02:00 Mohit Thatte mohit.tha...@gmail.com:
The interesting question here is what constitutes useful information!
(let [pred #(exists? .foo)]
(wait-until pred)) ;; - the fact that it's called 'pred is not
interesting in most cases
The trade-off is breaking an existing
I have one function wait-until whose definition is like-
(defn wait-until
[pred]
(wait-until* pred))
where, pred is a function wai-until* is some internal working.
Now, I want to modify it like-
(defn wait-until
[pred]
(try
(wait-until* pred)
(catch Exception e
I'd definitely go with 1.), because the `exec` in 2.) is basically `eval`
and thus should be used most sparingly.
You can also expand on 1.) by using a macro, that stores the source and
other debugging information in metadata and thus get all the benefits of
2.) and then some.
--
You received
13 matches
Mail list logo