Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^8: Win32, fork and XS globals

by ikegami (Pope)
on Oct 02, 2011 at 21:37 UTC ( #929182=note: print w/ replies, xml ) Need Help??


in reply to Re^7: Win32, fork and XS globals
in thread Win32, fork and XS globals

You pointed out it's not useful for static data. I contradicted that.

You said "_" was invisible. I contradicted that.

You indicated the use of "a", "d" and "p" was problematic. I contradicted that.

If you knew what you said was wrong, why did you say it, and why do you fault me for correcting it?


Comment on Re^8: Win32, fork and XS globals
Re^9: Win32, fork and XS globals
by BrowserUk (Pope) on Oct 02, 2011 at 23:21 UTC
    You said it's not useful for static data.

    No. I said: "An example of "Safely Storing Static Data" that doesn't appear to declare any static data is pretty worthless."

    You contradicted what you imagined I said, not what I actually said.

    There are so many things wrong with that example it is hard to know where begin.

    • The title of the section talks about "static data".

      In C, the keyword 'static' has a very particular meaning and purpose. It denotes both persistence and limited visiblity.

      Used within a function, the value of static variables persist between calls, but their visibility is restricted to that function.

      Used outside of a function, not only does it retain it value like any normal global, but also its visibility is restricted to the source file it is declared in. (Ie. It cannot be addressed from another source file using extern!)

      The macros in that example address neither property correctly.

      What the macros actually operate on is global (or in C terminology: external) data. Not static data.

      And BTW, your statement above that " It can't be both static and per-interpreter. is utter bollocks. Here you go:

      static int var[NO_OF_THREADS];

      Per interpreter static integers.

      Which is essentially all those macros do, except they omit the 'static', meaning the potential for unintentional clashes between globals declared in different source files within the same compilation.

    • But the main problem is that what the macros actually do is not explained.

      For example. The context key you have to declare is never used:

      * 1. #define MY_CXT_KEY to a unique string, e.g. * "DynaLoader::_guts" XS_VERSION * XXX in the current implementation, this string is ignored.

      Which means that if you try to compile two files that each contain different MY_CXT declarations into a single binary, they conflict.

      All these macros do is abuse the pre-compiler to obscure and obfuscate what is a rudimentary and badly flawed implementation of a simple to understand and program technique for dealing with the issues of persistent data and threads.

    You said "_" was invisible.

    No. I said: "an almost invisible _".

    Saying that , is less visible than _ does not contradict what I said -- saying that 0.00001 is smaller than 0.0001, doesn't make the latter not small -- it is just a puerile attempt to justify its use.

    A justifiction that falls completely flat if you take syntax highlighting into consideration. Or a programmer's font.

    You indicated the use of "a", "d" and "p" was problematic.

    No. I said: "stupid, bordering on criminal".

    Saying that it is done other places does not contradict the premise that it is bad practice. The fact that years ago, putting fizzy drinks and household chemicals in nearly identical bottles was normal practice, didn't make it a good idea which is why legislation prevents that in the modern world.

    Again, not contradiction, just a justifiction.


    1. So, you didn't contradict what I said, but what you thought I said.

      Contradiction isn't a valid argument form anyway.

    2. Instead of just trying to help the OP, you try to make political capital from a documentation reference.

      I'll point out again. Had you posted your initial response to the OP and not me, this long and sorry sub-thread would not exist.

    3. Please take special note of the very first sentence of my initial response to you: Personally, I found that example almost completely useless.

      Your opinion does not override, negate or change my opinion.

    4. But most damning of all:

      You try to come across all superior, by taking the documentation as gospel and good, and quoting it verbatim, rather than actually thinking through the implications.

    For all the good information that you've supplied me down the years -- much of it uniquely -- I'm sick of these pointless exchanges, so please stop responding to my posts.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      No. I said: "an almost invisible _"

      Why did you mention it if it's not a problem? Why did you agree with me that it's not a problem if it is a problem?

      I can't see any possible reading other than it's suffering from visibility issues. If you meant something else, you need to be clearer.

      saying that 0.00001 is smaller than 0.0001, doesn't make the latter not small

      It does if 0.0001 is considered not small. "_" stands for ",", and "," is not considered invisible, almost invisible or in any way visibility-impaired in that same situation.

      But of course, you already know this even though you argue against it.

      Here you go: static int var[NO_OF_THREADS];

      That's completely wrong. Threads are just one form of interpreter. You'd need a dynamically sized array, so static storage is impossible.

      But of course, you already know this even though you argue against it.

      No. I said: "stupid, bordering on criminal".

      If being "stupid, bordering on criminal" is not a problem, we're not talking the same language.

      Your opinion does not override, negate or change my opinion.

      Please note than when I provided my opinion in turn, you berated me for stating it. If you want respect, show some yourself.

        Stop trolling

        Why did you agree with me

        I never did. Anywhere. Not once. So, Just stop.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

      In C, the keyword 'static' has a very particular meaning and purpose. It denotes both persistence and limited visiblity.

      Yes, and the mechanism provides the same persistence and limited visibility in Perl's memory space.

      But the main problem is that what the macros actually do is not explained.

      Which one do you think isn't explained? Unless I'm missing one, the example explains exactly how to use each one.

      You try to come across all superior, by taking the documentation as gospel and good, and quoting it verbatim, rather than actually thinking through the implications.

      Your argument is lost because every premise is completely wrong.

      • I didn't take the docs as gospel. I've actually used the mechanism recently. It was easy, it did the trick, and it should do the trick for the OP.
      • I didn't quote any docs.
      • I did think through the implications: It solves the OP's problem cleanly and simply. Perhaps you are over-thinking it or trying to make a political statement.

      Instead of just trying to help the OP, you try to make political capital from a documentation reference.

      That makes no sense. I simply provided a link that explained how to use the mechanism *you* suggested, since you completely failed to help the OP in that regard.

        There it is right there. I say, and you even quote me saying: "what the macros actually do is not explained."

        And your response is

        the example explains exactly how to use each one.

        It is impossible to make any headway with you, because you don't read what is written -- even when you've just quoted it -- and then you prattle on and on about things that simply aren't in dispute.

        So, just stop!


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://929182]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (12)
As of 2014-04-16 08:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (419 votes), past polls