@Bleistivt I read your link, but it talks about data types.
My point (and the topic of the poll) was that valr() & co. are not recursive functions
If one would want to argue that valr() is indeed recursive since it makes use of arrays which are recursively defined data types, then every function using an array would have to be called recursive. If the argument is that valr() traverses a recursive data type, then every for-loop over an array would have to be called recursive, too
@hgtonight schrieb:
There was never any question whether the function was iterative. The name refers to the data type it works with.
Let's consult our primary source here:
if (!function_exists('getValueR')) {
/**
* Return the value from an associative array or an object.
*
* This function differs from GetValue() in that $Key can be a string consisting of dot notation that will be used
* to recursively traverse the collection.
...
So the postfix 'r' (whether it is a postfix or a suffix shall be the topic for a future debate) stands for "recursive traversal". Which is exactly what you, hgtonight, already suspected earlier. However, there is no recursive traversal. In fact, there can be no recursive traversal without recursive traversal function
The argument that getValueR() performs recursive traversal because the variable it iterates through has a recursively-defined datatype could equally be used to argue that inspecting any array or object properties is recursive traversal - which is clearly not the case.
This discussion shall remind all of us of the horrors that await those who prematurely name their functions.
My 5 cents on the whole "recursive vs. iterative" discussion: The functions are by all means iterative and have nothing to do with recursion. The r-suffixed ones are however deep in the sense that they can traverse more than one level down object and array properties.
@Linc schrieb:
Now you're referencing code that isn't even ours
That's kind of the point. Vanilla includes "private use only" code that some of us (and you) use commercially. Not that I care, but the author of that library might
Feel free to distribute as long as code is not modified
Todd ported the code from WebWiz's functions_hash1way.asp to Vanilla PHP. I would argue that a port is a modification.
@Linc said:
I read that statement as part of a disclaimer, not a licensing restriction. The author is free to disagree or clarify.
I don't see much room for interpretation in "private use only". However, I see where you come from. That code is old, the author might not care and the whole thing is just an annoyance. But what if the author decides to care one day?
Let's say you don't agree with me on these two points. Then here is why that code should really be removed from the Vanilla codebase:
"Distribution or modification of programs, including incompatibly licensed code, will result in copyright infringement." ("Understanding Open Source and Free Software Licensing" by Andrew M. St. Laurent, O'Reilly Media, Inc., 2004)
or
"If I add a module to a GPL-covered program, do I have to use the GPL as the license for my module? The GPL says that the whole combined program has to be released under the GPL. So your module has to be available for use under the GPL." (gpl faq)
Clearly, "Feel free to distribute as long as code is not modified" is not GPL compatible.
I think it is quite clear and there is no need to cite third party meta open source license philosophers
3. License Grant Licensor grants Licensee a non-exclusive, non-transferable license to use Software for personal or
business purposes, in accordance with clause 4 below, any copy must contain all of the original
proprietary notices. (...)
4. Permitted Use
(...)
4.2. You may modify the Software, so long as it is permitted in this Agreement.
(...)
6. Undertakings You undertake to;
(...)
6.2. reproduce and include our copyright notice (or such other party's copyright notice as specified
on the Software) on all and any copies of the Software, including any partial copies of the
Software or it’s derivative works;
(...)
What is described in 6.2 is a very good description for how Vanilla uses their code: "partial copy"/"derivated work".
So I would say that enclosing their license text as a comment in the file is all that is needed. And that would also mean that there is no problem using the software commercially.
I wouldn't care about that since this function is part of the web wiz forum and I see no reference of any meaning anywhere else. So I would go with the web wiz license.
@mtschirs said:
I would argue that a port is a modification.
Based on the copyright act, they write: Almost everyone agrees that if you take the copyrighted source code of any program and physically modify it—actually revise the program or translate it into another computer language—you have created a derivative work of that program.
@R_J The only relevant (copyright and) licensing clause here is the one found in the header of the source code:
' Written By: Mark G. Jager
' Written Date: 8/10/2000
'
' Free to distribute as long as code is not modified, and header is kept intact
and in one particular case
' This code is for private use only
Whether or not other projects (such as web wiz whatever) re-package and distribute that code with their software is irrelevant to Vanilla as long as the original author hasn't made its code available under a GPL compatible license by dual/cross licensing.
It is the same issue e.g. bloggers face when using photos from another website which mistakenly states them as being licensed under CC. The original photographer can still sue for copyright infringement.
Actually, if you chose to ignore the file-scope licensing terms of Mark G. Jager and go with the Web Wiz license instead, you are in for even more trouble.
Permitted Use
4.2. You may modify the Software, so long as it is permitted in this Agreement.
Restrictions On Use
5.1. You shall not resell, rent, lease or distribute the Software.
5.5. You shall not use any part of the Software outside of the Software package, this includes, but not limited to, displaying or ‘hot linking’ to, icons, images and graphics.
5.7. [... A] valid copyright notice must be provided within the user documentation that specifies ‘Web Wiz’ as the provider of the Software bundled with the licensee’s application.
This discussion would be a lot less annoying if every time someone made fun of some old code that has decayed they also included a pull request that fixes it. Especially in such trivial cases as a docblock that has stopped matching the code.
Otherwise its just frustrating to read what is essentially mockery of something that many people here have devoted more than half a decade to building.
/**
* If you abuse this hook, Tim will throw a Coke can at your head.
Just got hit, ouch
Tim, I posted such code comments because they made me smile when I stumbled across them; the emotional ones show affection; others - such as the one above - are pure kafkaesque gold, woven over time by many unsuspecting commits.
Some of my postings however are meant to be understood as a critique and I always either send a PR or otherwise invest time to find a solution (e.g. the licensing issue on which I send you an elaborate email).
This "Hall of Code Curiosities" was meant to reflect on
Vanilla is the best, most powerful community solution in the world.
and was written in the spirit of
This lighthearted thread shall be the much needed place to vent our experiences with the code we love .
It seemed to have missed that mark, so I don't mind letting it rest.
Comments
@Bleistivt I read your link, but it talks about data types.
My point (and the topic of the poll) was that valr() & co. are not recursive functions
If one would want to argue that valr() is indeed recursive since it makes use of arrays which are recursively defined data types, then every function using an array would have to be called recursive. If the argument is that valr() traverses a recursive data type, then every for-loop over an array would have to be called recursive, too
n < 20
Vanilla is probably bipolar. Massaging one line, refusing to hold hands the next day:
https://github.com/vanilla/vanilla/blob/1ae06b/applications/dashboard/controllers/class.entrycontroller.php#L1008
There was never any question whether the function was iterative. The name refers to the data type it works with.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
you got me
Let's consult our primary source here:
So the postfix 'r' (whether it is a postfix or a suffix shall be the topic for a future debate) stands for "recursive traversal". Which is exactly what you, hgtonight, already suspected earlier. However, there is no recursive traversal. In fact, there can be no recursive traversal without recursive traversal function
The argument that getValueR() performs recursive traversal because the variable it iterates through has a recursively-defined datatype could equally be used to argue that inspecting any array or object properties is recursive traversal - which is clearly not the case.
This discussion shall remind all of us of the horrors that await those who prematurely name their functions.
I'd say: 5 votes doesn't make a poll. But we could have a vote about that
My 5 cents on the whole "recursive vs. iterative" discussion: The functions are by all means iterative and have nothing to do with recursion. The
r
-suffixed ones are however deep in the sense that they can traverse more than one level down object and array properties.Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
In library/vendors - functions.webwizhash.php:
I hope nobody uses Vanilla commercially
Now you're referencing code that isn't even ours
That's kind of the point. Vanilla includes "private use only" code that some of us (and you) use commercially. Not that I care, but the author of that library might
Given the context it is in, after this:
and just before this:
I read that statement as part of a disclaimer, not a licensing restriction. The author is free to disagree or clarify.
The 3rd party license says:
Todd ported the code from WebWiz's functions_hash1way.asp to Vanilla PHP. I would argue that a port is a modification.
I don't see much room for interpretation in "private use only". However, I see where you come from. That code is old, the author might not care and the whole thing is just an annoyance. But what if the author decides to care one day?
Let's say you don't agree with me on these two points. Then here is why that code should really be removed from the Vanilla codebase:
or
Clearly, "Feel free to distribute as long as code is not modified" is not GPL compatible.
Are you talking of that license? (Not sure because I never heard of Web Wiz before) https://www.webwiz.co.uk/license/Web Wiz License Agreement.pdf
I think it is quite clear and there is no need to cite third party meta open source license philosophers
3. License Grant
Licensor grants Licensee a non-exclusive, non-transferable license to use Software for personal or
business purposes, in accordance with clause 4 below, any copy must contain all of the original
proprietary notices. (...)
4. Permitted Use
(...)
4.2. You may modify the Software, so long as it is permitted in this Agreement.
(...)
6. Undertakings
You undertake to;
(...)
6.2. reproduce and include our copyright notice (or such other party's copyright notice as specified
on the Software) on all and any copies of the Software, including any partial copies of the
Software or it’s derivative works;
(...)
What is described in 6.2 is a very good description for how Vanilla uses their code: "partial copy"/"derivated work".
So I would say that enclosing their license text as a comment in the file is all that is needed. And that would also mean that there is no problem using the software commercially.
@R_J I am not talking about that license (otherwise you might be right), but about the license found in vanilla/library/vendors/misc/functions.webwizhash.php
I wouldn't care about that since this function is part of the web wiz forum and I see no reference of any meaning anywhere else. So I would go with the web wiz license.
Others call it a derivative work which results to much more freedom concerning the license: http://www.linuxjournal.com/article/6366
Based on the copyright act, they write: Almost everyone agrees that if you take the copyrighted source code of any program and physically modify it—actually revise the program or translate it into another computer language—you have created a derivative work of that program.
So there is even less reason for doing anything.
@R_J The only relevant (copyright and) licensing clause here is the one found in the header of the source code:
and in one particular case
Whether or not other projects (such as web wiz whatever) re-package and distribute that code with their software is irrelevant to Vanilla as long as the original author hasn't made its code available under a GPL compatible license by dual/cross licensing.
It is the same issue e.g. bloggers face when using photos from another website which mistakenly states them as being licensed under CC. The original photographer can still sue for copyright infringement.
Actually, if you chose to ignore the file-scope licensing terms of Mark G. Jager and go with the Web Wiz license instead, you are in for even more trouble.
The comment:
The code:
Man, this thread took a pretty dank turn for a while. Thanks for bringing back the entertainment value, @mtschirs
This discussion would be a lot less annoying if every time someone made fun of some old code that has decayed they also included a pull request that fixes it. Especially in such trivial cases as a docblock that has stopped matching the code.
Otherwise its just frustrating to read what is essentially mockery of something that many people here have devoted more than half a decade to building.
Thats just my 2 cents though.
Vanilla Forums COO [GitHub, Twitter, About.me]
Just got hit, ouch
Tim, I posted such code comments because they made me smile when I stumbled across them; the emotional ones show affection; others - such as the one above - are pure kafkaesque gold, woven over time by many unsuspecting commits.
Some of my postings however are meant to be understood as a critique and I always either send a PR or otherwise invest time to find a solution (e.g. the licensing issue on which I send you an elaborate email).
This "Hall of Code Curiosities" was meant to reflect on
and was written in the spirit of
It seemed to have missed that mark, so I don't mind letting it rest.