183 reputation
8
bio website
location London
age 24
visits member for 2 years, 5 months
seen 2 days ago

London-based full-stack developer.

I'm fluent in: JavaScript, Python, and PHP, literate in Objective-C, Ruby, and Bash, and have screwed about a bit with Java, C#, Scheme, and C.

Feel free to contact me at markamery@btinternet.com


I give all my contributions on Stack Overflow to the public domain, to the greatest extent permitted by law. If for some reason that's not possible in your jurisdiction, I license you to use them in any way you like.

If you find something wrong in one of my posts, feel free to edit it. I'm a frequent visitor and can always roll back if I think a change you've made is wrong or stupid, so you may as well be bold - it's better, here, to ask for forgiveness than permission.


My GitHub profile: https://github.com/ExplodingCabbage


Mar
7
comment How does fair use apply to code snippets?
@Huperniketes, you claim I am making idiotic assertions without knowing the material when I have asserted nothing about the law. You are the one making the legal claim - that, contrary to a plain English reading, your italicized passage shows that copying code snippets into software can never be fair use. I am sceptical of that claim, but sure, I don't know any case law to support or disprove it. Which is why I'm not making factual claims. The burden of evidence is on you if you want to be believed, but you've chosen to sneer at and insult those who neutrally ask you to show evidence.
Feb
20
comment How does fair use apply to code snippets?
And what qualifications do you have to "expound on the law", @Huperniketes? You've written this as though you are quoting an authority that definitively shows copying code not to be fair use, but in fact you're just performing your own interpretation of statute without even citing any case law.
Dec
9
awarded  Autobiographer
Dec
8
awarded  Popular Question
Sep
13
comment Function only returns unchanged parameter, useless?
Yes, though it's worth noting that the doctstring of the function posted by the OP does not suggest that this is the purpose of the function in his case.
Sep
7
asked Why does “charset” really mean “encoding” in common usage?
Dec
8
awarded  Editor
Dec
8
revised Is changing the type of a variable partway through a procedure in a dynamically typed language bad style?
deleted 1 characters in body
Apr
1
comment Is (1/(1/x)) always a perfect round trip?
So many terrible answers here, but this one actually addresses the specific question that was asked. I can't believe the sheer number of people who just said 'no, because of floating point precision' and thought that was good enough, without any proof or examples to show that the rounding errors from the two reciprocations wouldn't always cancel out (or as you would put it, that some non-fixed points of double-reciprocation of mantissas exist :P). A big +1, although this feels a little terse and intimidating at present.
Apr
1
comment Is (1/(1/x)) always a perfect round trip?
-1, because you've just explained how the limited precision of floating points can lead to rounding errors without showing, or even trying to show, that it can cause the specific problem the question asked about. Without either a little testing or a little mathematics, it's pretty non-obvious to me whether the rounding error on the second division will cancel out the rounding error on the first division sometimes, always, or never.
Apr
1
awarded  Critic
Feb
20
accepted Is changing the type of a variable partway through a procedure in a dynamically typed language bad style?
Feb
18
awarded  Scholar
Feb
18
comment Is changing the type of a variable partway through a procedure in a dynamically typed language bad style?
This seems like a reasonable objection, and I think I'll try to phase this kind of style out of my code. Followup: how would you name different variables that conceptually refer to the same thing, but with different types? Hungarian notation is kind of ugly, and trailing types (like having response_addurlinfo, response_str, response_dict) are uglier still. What do you do?
Feb
17
asked Is changing the type of a variable partway through a procedure in a dynamically typed language bad style?
Feb
9
comment Is declaring fields on classes actually harmful in PHP?
@Deco Not comparable because abandoning an entire language is a much larger change than just commenting out declarations in PHP. Jarrod's answer is useful because - while I query or challenge parts of it - it points out some actual downsides, none of which I knew about when I posted the question. A better comparison - were it not for the tool-related downsides - would be something like using "use strict" in Javascript. Yes, you can always say it's pointless because you'd rather just not make the errors it protects you from by being a flawless human, but I'll take the help if it's free.
Feb
8
awarded  Commentator
Feb
8
comment Is declaring fields on classes actually harmful in PHP?
You may be right. I spent a couple of hours tracking down a bug today that turned out to be caused entirely by such a typo, and was frustrated afterwards by the sudden realization that if I'd only not used field declarations, I would've got a notice and known immediately where my error was (which I'd always thought would happen in these circumstances anyway; I didn't realize declarations initialized fields to null). The immediate accessibility of that experience is probably skewing my judgement of how likely it is to recur, or how worthwhile it is to defend against.
Feb
8
comment Is declaring fields on classes actually harmful in PHP?
In response to your proposed solution: this is precisely what I want to avoid - the assignment of defaults even when they are meaningless and the default values should never be used. The problem with these defaults (and with declaration without assignment, which just assigns null) is that if, due to a programming mistake, I don't assign a value to something in the constructor when I ought to, then rather than PHP giving a warning when I try to use that value later - helping me spot my error - everything will seem to work fine even though the class is broken.
Feb
8
comment Is declaring fields on classes actually harmful in PHP?
In response to your 5 downsides: 1 (Performance): Do you have a source for this? 2 (Readability): Not sure I understand; the proposal was for commenting out the declarations, not just removing them, so what readability is lost? Slightly less friendly syntax highlighting and potential difficulty distinguishing from neighboring comments, I guess? 3: This one I don't understand at all; can you clarify? 4 (IDEs): Fair enough - I don't have experience of coding PHP with an IDE and didn't know about Eclipse's type hinting. 5 (doc generators): Fair enough - never used one of these.