I get what you mean, and in general I err towards OO code over procedural
where possible too. However I also think cocking around adding new language
constructs is something that should be treated with extreme caution.
Yup.
My challenge here is that I think adding a time out to try/catch is just
wrong, so another approach is needed. It’s not that I think it’s better
or worse than a closure-based option (or even the other syntax variation
mentioned, which I’ll get to), I just think it’s absolutely the wrong and a
syntactically invalid approach.
This is where we must agree to disagree. It’s certainly unprecedented, but
that in and of itself is not a reason to not avoid it. It could be I’m
missing something, but I do see a certain elegance in it. It reads well to
me.
Some people would fall back to that “tags without angle brackets in
script” syntax for a solution, which - IMO - isn’t as bad in theory,
however I think the actual syntax variation is lazy and inelegant language
design which ought to be phased out of CFML… in favour of a “closure”
approach.I dunno if you read my blog or saw my earlier link, but I put my position
forward here:
Adam Cameron's Dev Blog: CFML: the evolution of functionality
http://www.google.com/url?q=http%3A%2F%2Fblog.adamcameron.me%2F2015%2F01%2Fcfml-evolution-of-functionality.html&sa=D&sntz=1&usg=AFQjCNErjIL26-DoX1tXSJUPlI-cDt6rZg
I have read it, and since you asked, TBH I’m not entirely sold that its bad
form. I think all that script tags need is to return its result instead of
assigning it to a variable based on a required attribute. I think I
remember that being suggested somewhere by Micha or Igal. I agree that ACF
devs completely blew it with their cftag() {} syntax, especially after
partially implementing the Railo/Lucee style.
…
My point was I saw a *possibility *of a race condition where a database
exception occurs at the same time the timeout occurs, in which case, are
the catch/finally blocks allowed to complete? From the way the request
timeout currently operates, I’m not sure that it would. If they are
allowed to complete - could the timeout handler execute first? Possibly.
Are these major blockers - no, just extra things to consider. However,
these are non-issues with the try/catch.Don’t follow you here sorry. Try again? (I might just be being thick).
I was trying to think of potential problems with implementation. Say you
have a try inside the first callback. The outside thread times out the
callback execution at the same time a database exception is triggered.
What gets run? Does the catch block execute in addition to the timeout
handler? In what order? Does the callback execute in a separate thread?
Is it always the same order? I have spent too much of my life chasing down
race condition errors, I’m perhaps hypersensitive to it.
You’re inventing a shortcoming here. …
What can I say, you caught me. Not knowing what could potentially be put
into the context argument, I cannot argue what it cannot do.
Well, that’s about all I got, at least for now. Sounds like several
threads may need to be started from this convo, but it’s way too late for
that right now, at least for me.
Jesse