The intent is that e.g. fmt( '{0} {{1} {2}} {{2}}', 'foo', 'bar', 'baz' ) produces foo {bar baz} {2} (which it actually does correctly). So replace braced number with the argument of that number, unless the braces are doubled.

For those who know Javascript but not ES6, the ES6 features used here are ... to implicitly turn the argument list into an array, and the => operator which works like it does in C#.

OK, so I use the string replace method with a callback for each capture. There are 4 capture groups:

$1: the optional escaping {

$2: the inner braces and number

$3: the number

$4: the optional escaping }

If both $1 and $4 are present, then the braces are escaped, so return $2 (the inner brace and number). Otherwise, return the argument with index $3, using the + operator to cast to number. If the argument is half-escaped, then make sure you put the non-escaping brace back in.

Filed under: Is there a FOSS license where you can only use the code if you don't attribute it to me?

Look at it this way. A decade or so from now, when you're training up a neophyte in the field and they make some really WTFy code that depresses them, you can show them your code as an example why they have no reason to give up hope.

@aliceif wondered if the FSF would call the public domain declaration Free. You said they wouldn't, and only GPL and derivatives are acceptable.

I pointed out that they classify licenses by (1) freedom and (2) GPL-compatibility. These are different, which is why they are listed differently. There are plenty of FSF-declared "Free" licenses that are not only weaker than the GPL (like CC0) but that several GPL-_in_compatible licenses are considered "Free" by the FSF.

Of course they state a preference for GPL-compatible and copyleft when possible -- but their definition of Free certainly doesn't demand either.

and yet public domain (which can be used in non-free) is approved by the FSF (although they do prefer you use a mostly equivilant CC0 license which is basically "if it's legal for this thing to be in public domain, it's in public domain, otherwise heres a super permissive license that lets you do whatever the heck you want"

I made the point that some hypothetical license would probably not be acceptable as a "free software" license to the FSF, because it lacks several of the clauses necessary for an FSF-style licence (forcing distribution of the sourcecode along with the binaries, for example).

I made this point in an admittedly imprecise, conversational way. You then made a spirited attempt for a pedantry badge at about 11:55pm my local time, which didn't really give me time to make any kind of sensible response until about now.

My point being is that you can't take GPL code and include it in, say, an Apache License 2.0 project. Because GPL explicitly forbids relicensing.

Yes, you can do that [for GPL3 code]. It's just that the conglomerate will be subject to the GPL instead of Apache license. You can still release the other parts of the project under the Apache license.

If that's not acceptable because you want the whole project Apache, then you can't do it, but that's your decision, not the licenses being incompatible.

I'm not trying to argue that the GPL or FSF is "right", nor do I have a problem with describing the GPL's requirements as "viral", nor do I acknowledge that there are some combinations that one might like to make of GPL + non-GPL code that isn't permitted, such as GPL+CDDL or GPLv2+Apache. But to say that the only GPL-compatible license is the GPL & variants is... taking a pretty useless definition of "compatible" IMO.

Yes, you can do that [for GPL3 code]. It's just that the conglomerate will be subject to the GPL instead of Apache license.

Actually, you can't (in a pedantic sense). Though it's quite possible to make the software release, you can't have the result be part of an Apache project. Software released by Apache projects always uses the Apache license. The act of releasing the thing with the GPL bit in it makes it non-Apache. However, that doesn't flow backwards into the rest of the code so long as it is meaningfully usable without the GPL code: since there's no reasonable sense in which the Apache code could be said to be a derivative work of the GPL code (unlike the aggregation of the two), license infectivity is denied.

(I've got a project in the Apache Incubator process right now. I know what the licensing restrictions are. The code in question used to be LGPL, but we're changing the license. We can do that: we've got the copyright assignments on file. )

The code in question used to be LGPL, but we're changing the license. We can do that: we've got the copyright assignments on file.

As I understand it, you can't revoke the existing license you've granted, but that only covers the exact version you released. You, as the copyright owner, are free to license any other versions under any terms you choose, or to dual license the existing version.

No one said anything about making it a project under the Apache organization. Besides, I even specifically addressed the case you're talking about: if you can't include GPL code in an Apache project because of the GPL license, that's not because the GPL code is incompatible with your code's license, it's incompatible with your goals/requirements.

When we say that GPLv2 and GPLv3 are incompatible, it means there is no legal way to combine code under GPLv2 with code under GPLv3 in a single program. This is because both GPLv2 and GPLv3 are copyleft licenses: each of them says, “If you include code under this license in a larger program, the larger program must be under this license too.” There is no way to make them compatible. We could add a GPLv2-compatibility clause to GPLv3, but it wouldn't do the job, because GPLv2 would need a similar clause.