CVS edit link for dickson.michael

My employer has authorized me to release several modules we have written for Drupal. In particular:
- an API for working with tables, swapping rows with columns, extracting subtables, sorting, etc.
- an API to create /indexable/ "serialized" data (e.g. what is currently saved in $user->data could now be searched)
- an API for defining realms [e.g. node/1] and their relations to each other [e.g. node/1 owned by user/1 part of term/2]

The last one is particularly useful for improving the access system. It allows (and has been used to build) a simple lattice access system - using realms to provide per-object limitations on user rights, and roles to define those rights.

I believe all these modules will greatly assist in correcting certain built-in limitations in core (and also help with core readability, which I've noticed deteriorating). To that extent, I wish to place them in contrib for public testing before attempting to merge them into core.

Comments

dickson.michael’s picture

StatusFileSize
new2.38 KB

F.module: Sort-of like Lambda functions. Except they're objects. And work as far back as PHP4. And have pseudo-currying. Not the prettiest code, but perfectly functional.

Used in tabular data module, for sorting [e.g. a drupal_sort() function]. BSD Licensed.

$f = f('$arg1,$arg2,$arg3',
  'return $arg1 . $arg2 . $arg3;'
);
$g = $f->curry('z');

$h = f_cuf($g);
echo call_user_func($h, 'A', 'b'); // prints "zAb"
dickson.michael’s picture

StatusFileSize
new3.08 KB

Table.module: Helpful functions for working with tabular data. Note in particular table_sort(), which builds on f.module to make a very short and sweet sorting method. BSD Licensed.

dickson.michael’s picture

Status: Needs review » Postponed (maintainer needs more info)
StatusFileSize
new2.63 KB

Dictionary.module: To make working with VOs and Arrays easier. Note dictionary_overlay(), dictionary_underlay(), and dictionary_merge(). Easy names to remember how they work. Also note that dictionary_merge() is the way we intuitively expect module_invoke_all() to behave with non-numeric keys, as array_merge_recursive() can have side-effects. BSD Licensed.

dickson.michael’s picture

Status: Postponed (maintainer needs more info) » Needs review

That'll do for now... the other modules have a database component, and I still have to learn Drupal 7's database layer (the modules were all written for Drupal 5 initially).

/me still can't believe Drupal went to Objects for the database layer.

avpaderno’s picture

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review your code, pointing out what needs to be changed.

We review just a theme / module per applicant; choose the one you want to be reviewed, and let us know it.

As per http://drupal.org/cvs-application/requirements, the motivation message should be expanded to contain more details about the features of the proposed module, and it should include also a comparison with the existing solutions.

As you agreed, the code hosted on Drupal.org must be licensed under the same license used by Drupal, which is not BSD.

dickson.michael’s picture

Can't review Table or Dictionary without first reviewing F, so the choice is obvious. I'll pick that. But it's rather pointless without the others. (They aren't merged into one module because that would be rather monolithic - not modular.)

F.module:
Goal: None, really. Except to make cleaner code where possible.
Existing Solutions: PHP native lambda functions. PHP 5.3+ only.
Utility For: Various other API abilities. No user-facing benefits.
Features: (almost) Lambda functions with (almost) Currying.
Problems: That (almost) part. It's nowhere near as elegant as ML or Haskell. And it uses eval(), which is a call I don't trust.
Benefits: Just look at table_sort(). No globals, no static variables, no OOP... it's simple, generates short functions, and is still readable.

---

BSD License is more-free than GPL2, so I'll dual-license these. Then the lawyers can be happy, and so can the rest of the world.

/me always thought Debian was particular about licenses...

avpaderno’s picture

When you applied for a CVS account, you agreed to commit only code licensed under GPL License V2+ (if I recall well); BSD code is not accepted in Drupal.org repository, as every module (and theme) is released under the same license used by Drupal.

dickson.michael’s picture

Status: Postponed (maintainer needs more info) » Needs review

As the author, I have the right to release code under whatever license I please. If Drupal agrees only to host code licensed under GPLv2, and if I wish to store my project on their server, then the code must be licensed under GPLv2. (Make no mistake that I misunderstood this).

However, there are no rules that state that you can take away my right to assign multiple licenses to my work. Therefore, while I am fully willing to license this under the GPL (as I agreed above), it is imperative that other users understand their right to select whichever license they would like to choose.

As the BSD license is more-free than the GPL, it is my attitude that most, if not all, users will choose the BSD license. (In addition, since the GPL is a superset of the BSD licensing terms, I had assumed that simply stating BSD license would be sufficient for Drupal's needs. Apparently I was mistaken about the level of commitment to freedom the Drupal community requires.)

avpaderno’s picture

Status: Needs review » Needs work
Issue tags: +Legal

As I said, for code committed on Drupal.org repositories, the code must be licensed under GPL License v2+, not BSD; you didn't report that the code is licensed under both GPL License v2+, and BSD, though.

As reported by Crell, in #719012-2: Module uses code protected with GPL 3 licence.:

CC content is not allowed in CVS. It's GPLv2+ or no dice.

Crell is the person responsible for such questions for Drupal Association; if he says so, then that is what is valid for Drupal.

avpaderno’s picture

Status: Needs work » Postponed (maintainer needs more info)
dickson.michael’s picture

Status: Postponed (maintainer needs more info) » Needs review

I have stated my agreement to place these under the GPLv2 in addition to the BSD license. This is the third time I have stated such.

These module(s) have been submitted for review. I'm sure there is more to it than just the license.

dickson.michael’s picture

And... I see that Drupal has added a whole new set of OOP rules to the Coding Standards, since last I checked it mid-2009. No need to point that out, I'll fix it.

avpaderno’s picture

Status: Needs review » Needs work
dickson.michael’s picture

Status: Needs work » Needs review
StatusFileSize
new1.87 KB

There... I think this is compatible with OOP coding standards (which seem to not be finished yet). If it isn't, I'd appreciate being told which part of the standards it isn't compatible with.

CHANGELOG:
- Licensed under GPLv2.
- Added f_call(); a drop-in replacement for call_user_func().
- Removed f_obj(); was buggy, and never used.
- Adopted Drupal OOP coding standards.
- Dropped support for PHP4.

New example usage:

$f = f('$arg1, $arg2, $arg3',
  'return $arg1 . $arg2 . $arg3;'
);
$g = $f->curry('z');

echo f_call($g, 'A', 'b'); // prints "zAb"
avpaderno’s picture

Status: Needs review » Fixed
Issue tags: -Legal +Module review

The copyright notice should be probably removed, to avoid problems if the license used by Drupal is changed (code committed in Drupal repositories doesn't have a choice about the adopted license, which must be the same used by Drupal).

The module doesn't considerate the case an argument must be passed by reference.

dickson.michael’s picture

With all due respect to Drupal, they do not have the right to make me give up copyright on my own code. No part of the GPLv2 state that Drupal has the right to change the license to anything other than future GPL versions. And if Drupal does requires that, it would be a violation of their own license (which states they may not add additional terms to the license)!

As for not supporting pass-by-reference, that's correct - and it's by design. I have trouble considering a scenario where someone would want pass-by-reference that isn't better handled, and better documented, by building a function the good old way. Can't fault that since even module_invoke_all() doesn't support pass-by-reference!

(Alternately: If someone /really/ needs pass-by-reference, it can always be added using the trick I describe in node/353494.)

avpaderno’s picture

With all due respect to Drupal, they do not have the right to make me give up copyright on my own code.

Uh?
As per nature of GPL License, as your module is using code that is licensed under GPL License v2+ (Drupal core code), your module can just be released under the same license of Drupal.
Nothing on Drupal.org says that the copyright of committed modules is transferred to somebody else. What I was saying is that it is better to remove any reference to the used license because it could create confusion, in the case Drupal would use a different license, and the comment in the code is still referring to the old license.

dickson.michael’s picture

Ah my confusion then. I read your line "the copyright notice should be probably removed" literally, to refer to the copyright itself, not the license the code is distributed under. Not to worry, I've lurked on enough message boards that I can grok the license issue.

But I do think keeping the notice is probably a good thing. i.e. I agree that if I choose to distribute code "linked" against Drupal 7, I use GPLv2. If Drupal changes it's license for a future version, and I wish to distribute code "linked" against this newer version, I must also change my license. But to remove the notice entirely is to suggest I've given up the right to review the new license and decide whether I wish to link against the new Drupal versions. Although not explicitly stated, it's implied, and in a court of law... implications do count. I know it's a technicality, but it's an important one, whichever side of the free-software fence one sits on.

avpaderno’s picture

See what reported in #726774-17: Drupal CVS applications and hosting may breach terms of GPL by Crell; he is the expert for such questions, and he wrote that:

The reason we ask module maintainers to not put additional copyright statements in is that it can create confusion. Eg, if someone checks in a module that says it is "GPLv2 only", that is against the CVS policy that requires GPLv2+. Thus, Drupal.org is then distributing code that says that it is both GPLv2 only and GPLv2+, which is just no good for anybody.

Status: Fixed » Closed (fixed)
Issue tags: -Module review

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Assigned: Unassigned » avpaderno
Issue summary: View changes