# Deprecate and remove case-insensitive constants?

- Thread: https://externals.io/message/100535
- Original archive: https://news-web.php.net/php.internals/100535
- Started by Christoph M. Becker on 2017-09-12T12:02:35+00:00
- Messages: 88
- Page 1 of 4: messages 1 to 25 (25 per page, add `?page=N` to the URL)
- Next page: https://externals.io/message/100535.md?page=2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #100535 — Christoph M. Becker — 2017-09-12T12:02:35+00:00

URL: https://externals.io/message/100535#100535

Hi everybody!

Usually constant identifiers are treated case-sensitive in PHP.  This is
always the case for constants defined via a `const` declaration.
However, `define()` allows to pass `TRUE` as third argument to define a
case-insensitive constant.  This feature appears to potentially result
in confusion, and also causes bugs as shown in
<https://bugs.php.net/74450>.  See an example created by Nikita to see
some probably unexpected behavior: <https://3v4l.org/L6nCp>.

Even if these issues could be resolved, I still think allowing both
case-sensitive and case-insensitive constant identifiers does more harm
than good, so either case-sensitive or case-insensitive constant
identifiers should be removed from the language.  Since case-sensitive
constant identifiers are already the default, and HHVM doesn't even
support case-insensitive identifiers at all, I would suggest to remove
case-insensitive constant identifiers.

This could be implemented by triggering `E_DEPRECATED` whenever the third
argument to `define()` is `TRUE` in PHP 7.3, and to remove this parameter
altogether in PHP 8.  Most likely some further simplification in the
engine could be done then as well.

Thoughts?

-- 
Christoph M. Becker

---

## #100537 — francois@tekwire.net — 2017-09-12T12:52:59+00:00

URL: https://externals.io/message/100535#100537 · In reply to: #100535

Hi,

Le 12/09/2017 à 14:02, Christoph M. Becker a écrit :
> Hi everybody!
>
> Usually constant identifiers are treated case-sensitive in PHP.  This is
> always the case for constants defined via a `const` declaration.
> However, `define()` allows to pass `TRUE` as third argument to define a
> case-insensitive constant.  This feature appears to potentially result
> in confusion, and also causes bugs as shown in
> <https://bugs.php.net/74450>.  See an example created by Nikita to see
> some probably unexpected behavior: <https://3v4l.org/L6nCp>.
>
> Even if these issues could be resolved, I still think allowing both
> case-sensitive and case-insensitive constant identifiers does more harm
> than good, so either case-sensitive or case-insensitive constant
> identifiers should be removed from the language.  Since case-sensitive
> constant identifiers are already the default, and HHVM doesn't even
> support case-insensitive identifiers at all, I would suggest to remove
> case-insensitive constant identifiers.
>
> This could be implemented by triggering `E_DEPRECATED` whenever the third
> argument to `define()` is `TRUE` in PHP 7.3, and to remove this parameter
> altogether in PHP 8.  Most likely some further simplification in the
> engine could be done then as well.
>
> Thoughts?

What about making PHP 8 100% case-sensitive (except true/false) ? If we 
announce it years in advance, it is possible, IMO.

Regards

François

---

## #100538 — Niklas Keller — 2017-09-12T12:53:53+00:00

URL: https://externals.io/message/100535#100538 · In reply to: #100535

2017-09-12 14:02 GMT+02:00 Christoph M. Becker <cmbecker69@gmx.de>:

> Hi everybody!
>
> Usually constant identifiers are treated case-sensitive in PHP.  This is
> always the case for constants defined via a `const` declaration.
> However, `define()` allows to pass `TRUE` as third argument to define a
> case-insensitive constant.  This feature appears to potentially result
> in confusion, and also causes bugs as shown in
> <https://bugs.php.net/74450>.  See an example created by Nikita to see
> some probably unexpected behavior: <https://3v4l.org/L6nCp>.
>
> Even if these issues could be resolved, I still think allowing both
> case-sensitive and case-insensitive constant identifiers does more harm
> than good, so either case-sensitive or case-insensitive constant
> identifiers should be removed from the language.  Since case-sensitive
> constant identifiers are already the default, and HHVM doesn't even
> support case-insensitive identifiers at all, I would suggest to remove
> case-insensitive constant identifiers.
>
> This could be implemented by triggering `E_DEPRECATED` whenever the third
> argument to `define()` is `TRUE` in PHP 7.3, and to remove this parameter
> altogether in PHP 8.  Most likely some further simplification in the
> engine could be done then as well.
>
> Thoughts?
>

+1

---

## #100539 — Christoph M. Becker — 2017-09-12T13:04:04+00:00

URL: https://externals.io/message/100535#100539 · In reply to: #100537

> What about making PHP 8 100% case-sensitive (except true/false) ? If we
> announce it years in advance, it is possible, IMO.

I don't think we can do that.  Consider, for instance, ext/gd where all
functions are actually in lower case, but I've seen a lot of code
written in pascal or camel case to make the functions better readable, e.g.

  imageCreateFromJpeg() vs. imagecreatefromjpeg()

-- 
Christoph M. Becker

---

## #100540 — Dan Ackroyd — 2017-09-12T14:04:28+00:00

URL: https://externals.io/message/100535#100540 · In reply to: #100539

>
> I don't think we can do that.  Consider, for instance, ext/gd where all
> functions are actually in lower case, but I've seen a lot of code
> written in pascal or camel case to make the functions better readable, e.g.
>
>   imageCreateFromJpeg() vs. imagecreatefromjpeg()

It's pretty easy to imagine that if we had function autoloading,
creating an optional small backwards compatibility shim/library to
work around that problem would be pretty easy.

It's also the type of error that would be easy to add a deprecation
warning to in a late 7.x branch.

cheers
Dan

---

## #100541 — Levi Morrison — 2017-09-12T14:52:38+00:00

URL: https://externals.io/message/100535#100541 · In reply to: #100537

On Tue, Sep 12, 2017 at 6:52 AM, François Laupretre
<francois@tekwire.net> wrote:
> Hi,
>
> Le 12/09/2017 à 14:02, Christoph M. Becker a écrit :
> > […]
>
>
> What about making PHP 8 100% case-sensitive (except true/false) ? If we
> announce it years in advance, it is possible, IMO.
>
> Regards
>
> François
>
>
> --
> 
> 

By itself this change provides little value. If it was done in
connection with other features such as merging symbol tables then we
can actually gain some significant improvements:

    array_map(sum2, $input1, $input2);

Currently that requires `sum2` to be a constant. To get the correct
behavior we currently need to do:

    array_map('fully\qualified\namespace\sum2', $input1, $input2);

This is not just convenience; it provides safety to refactoring and
general code analysis tools. Maintenance is a crucial aspect of large
code bases and being able to move away from stringly-typed things is a
significant improvement. It's also a step towards general autoloading
instead of just class/trait/interface autoloading; however this would
require further changes.

I believe these improvements would be worth it and do understand it is
a large backwards compatibility break. Given sufficient time and
tooling to prepare I think PHP would be markedly better in the
long-run for these two changes. However, if we change only the case
sensitivity of constants we gain little value for our BC break.

---

## #100542 — Levi Morrison — 2017-09-12T14:55:50+00:00

URL: https://externals.io/message/100535#100542 · In reply to: #100541

> By itself this change provides little value. If it was done in
> connection with other features such as merging symbol tables then we
> can actually gain some significant improvements:
>
>     array_map(sum2, $input1, $input2);
>
> Currently that requires `sum2` to be a constant. To get the correct
> behavior we currently need to do:
>
>     array_map('fully\qualified\namespace\sum2', $input1, $input2);

After rewriting my reply I noticed this sentence doesn't quite make sense:

> This is not just convenience; it provides safety to refactoring and
> general code analysis tools.

Instead I meant that using the string is not just inconvenient; it
also prevents fully-safe code refactoring and analysis.

> Maintenance is a crucial aspect of large
> code bases and being able to move away from stringly-typed things is a
> significant improvement. It's also a step towards general autoloading
> instead of just class/trait/interface autoloading; however this would
> require further changes.
>
> I believe these improvements would be worth it and do understand it is
> a large backwards compatibility break. Given sufficient time and
> tooling to prepare I think PHP would be markedly better in the
> long-run for these two changes. However, if we change only the case
> sensitivity of constants we gain little value for our BC break.

---

## #100544 — Rowan Collins — 2017-09-12T16:17:28+00:00

URL: https://externals.io/message/100535#100544 · In reply to: #100541

>    array_map(sum2, $input1, $input2);
>
>Currently that requires `sum2` to be a constant. 

I'm not clear what this has to do with case sensitivity; the problem here is that we don't have a type of "function reference" (nor "class reference") so simulate such references with strings and runtime assertions.

Are you saying that without case sensitivity, the language could deduce that sum2 in that case was a function reference? That seems optimistic: not only can you have a class, a constant, and a function all with the same name, but you can't actually know which exists until the line is executed, because all three can be defined at any time.

This kind of ambiguous syntax is precisely what I was trying to reduce by deprecating "undefined constant as string", and a similar "convenient fallback" (from current to global namespace) is currently the biggest thing blocking function autoloading.

If we want function and class references, they should have their own, unambiguous, syntax.

Apologies if I've completely missed the point here.

Regards,

-- 
Rowan Collins
[IMSoP]

---

## #100545 — Levi Morrison — 2017-09-12T16:45:46+00:00

URL: https://externals.io/message/100535#100545 · In reply to: #100544

> Apologies if I've completely missed the point here.

Oh well, it happens.

> Are you saying that without case sensitivity, the language could deduce that sum2 in that case was a function reference? That seems optimistic: not only can you have a class, a constant, and a function all with the same name, but you can't actually know which exists until the line is executed, because all three can be defined at any time.

Close. If we make case sensitivity consistent (either all insensitive
or all sensitive) *and* merge symbol tables then we can get actual
features out of it. As it stands just changing the case sensitivity
does not buy as any features for our BC break.

The rest of my message only makes sense once you understand I was
proposing unified case sensitivity for all symbols *and* merging them
into one table.

> > […]
>
> I'm not clear what this has to do with case sensitivity; the problem here is that we don't have a type of "function reference" (nor "class reference") so simulate such references with strings and runtime assertions.

This confusion stems from the aforementioned items.

> If we want function and class references, they should have their own, unambiguous, syntax.

My point was rather that if we fix our inconsistency issues and merge
the tables no such syntax is required; all existing syntax works.
There are engine changes that have to accompany those as well,
obviously.

In summary I think changing constant case sensitivity is too small of
a step to gain us anything, but would be *very* happy to take it
further because it will give us actual features for our trouble.

---

## #100547 — Sara Golemon — 2017-09-12T17:05:47+00:00

URL: https://externals.io/message/100535#100547 · In reply to: #100535

> Even if these issues could be resolved, I still think allowing both
> case-sensitive and case-insensitive constant identifiers does more harm
> than good.
>
+0.1 to removing case-insensitive constants, though we'd need to
define both "null" and "NULL" (similar for true and false) since
there's little consensus on which version of these constants get used
from project to project.  Also: While deprecating for 7.3 is fine, I'd
favor waiting for 8.0 for full removal.

As to François' suggestion to make the whole language case-sensitive?
Yeesh, that feels like a much more aggressive movement.  In the case
of constants they very nearly are case-sensitive only since, as you
point out, common practice is to not pass true for that third
parameter, and to prefer `const` over `define` anyway.  Identifiers
are another matter since they're insensitive by default.

In the case of classnames I could almost get on board since
autoloading standards have pushed users naturally in the direction of
respecting case sensitive as a coding standard.  I don't feel as
though that's true of functions or of projects where autoloaders
aren't used (not a small number).

Overall: No.  I'm -1 on making non-constant identifiers
case-sensitive.  At best, I'd perhaps get on board with a
declare(case_sensitivity=1); style directive.

-Sara

---

## #100548 — Rowan Collins — 2017-09-12T17:59:59+00:00

URL: https://externals.io/message/100535#100548 · In reply to: #100545

>The rest of my message only makes sense once you understand I was
>proposing unified case sensitivity for all symbols *and* merging them
>into one table.

Ah, OK, so I partially missed the point. I'm still not sure what you're suggesting is sensible, though...


> > […]

I stand by this assertion. Consider the following statement:

$foo = bar;

Even if "bar" cannot *simultaneously* be the name of a function, a class, and a constant, it can still *potentially* be any of the three, from the point of view of the compiler. 

So, far from allowing us to make nice inferences about function references vs strings-that-look-callable, we have now *broken* assumptions we could previously have made.

It seems like we'd just be adding another equally ambiguous way of writing the same code.

Regards,

-- 
Rowan Collins
[IMSoP]

---

## #100549 — Stanislav Malyshev — 2017-09-12T19:43:42+00:00

URL: https://externals.io/message/100535#100549 · In reply to: #100535

Hi!

> case-insensitive constant.  This feature appears to potentially result
> in confusion, and also causes bugs as shown in
> <https://bugs.php.net/74450>.  See an example created by Nikita to see
> some probably unexpected behavior: <https://3v4l.org/L6nCp>.

The latter case probably should be fixed by not allowing second constant
to be defined. If you already have case-insensitive constant, it should
cover all of those.

> Even if these issues could be resolved, I still think allowing both
> case-sensitive and case-insensitive constant identifiers does more harm
> than good, so either case-sensitive or case-insensitive constant
> identifiers should be removed from the language.  Since case-sensitive
> constant identifiers are already the default, and HHVM doesn't even
> support case-insensitive identifiers at all, I would suggest to remove
> case-insensitive constant identifiers.

I don't think HHVM not supporting something can be an argument. I'm
worried about `TRUE` vs. True vs. true though - I've see all of those used
around the code (not tRuE though ;) and breaking that would add a ton of
meaningless work to maintainers without any upside. Same with NULL/null etc.

I am also not convinced those constants are really that bad. I'd
probably be fine with phasing out manual defines for case-insensitives
though. But I'm not sure what purpose it would serve then - the engine
would still have to support it, no?

-- 
Stas Malyshev
smalyshev@gmail.com

---

## #100550 — Sara Golemon — 2017-09-12T19:55:57+00:00

URL: https://externals.io/message/100535#100550 · In reply to: #100549

> I don't think HHVM not supporting something can be an argument.
>
I agree there, though I will offer that part of the reason HHVM has
never bothered to support case-insensitive constants is that it's
simply never needed to.  The only major project that didn't work out
of the box was Wordpress, and when they saw my blogpost about their
one case-insensitive constant, they switched it to being
case-sensitive, because EVEN WORDPRESS thought they'd maintained that
BC long enough. :)

> I'm worried about `TRUE` vs. True vs. true though - I've see all of those used
> around the code (not tRuE though ;) and breaking that would add a ton of
> meaningless work to maintainers without any upside. Same with NULL/null etc.
>
We could always special case these in the lexer, or during
compile-time constant folding.  I agree they're a concern (and already
noted as much in my previous reply), but they're an entirely tractable
concern.

-Sara

---

## #100551 — Levi Morrison — 2017-09-12T20:35:51+00:00

URL: https://externals.io/message/100535#100551 · In reply to: #100548

> 
> > […]
>
> Ah, OK, so I partially missed the point. I'm still not sure what you're suggesting is sensible, though...
>
>
> > […]
>
> I stand by this assertion. Consider the following statement:
>
> $foo = bar;
>
> Even if "bar" cannot *simultaneously* be the name of a function, a class, and a constant, it can still *potentially* be any of the three, from the point of view of the compiler.

If it's known, it's known, and it can proceed with that type. If it's
not known then autoload and proceed like normal. I fail to see how
this is an issue, and in fact, see it as a *significant* improvement
to our current situation...

---

## #100552 — Christoph M. Becker — 2017-09-12T21:02:14+00:00

URL: https://externals.io/message/100535#100552 · In reply to: #100550

> 
>
> > […]
>
> We could always special case these in the lexer, or during
> compile-time constant folding.  I agree they're a concern (and already
> noted as much in my previous reply), but they're an entirely tractable
> concern.

Sorry, I forgot to mention these special constants which are reserved
words right now.  Of course, these have to stay case-insensitive, and we
simply could promote them to keywords which are case-insensitive, anyway.

-- 
Christoph M. Becker

---

## #100553 — Christoph M. Becker — 2017-09-12T21:32:33+00:00

URL: https://externals.io/message/100535#100553 · In reply to: #100541

> On Tue, Sep 12, 2017 at 6:52 AM, François Laupretre
> <francois@tekwire.net> wrote:
> > […]
>
> […] However, if we change only the case
> sensitivity of constants we gain little value for our BC break.

I have not suggested to *change* the case sensivity of constants, but
rather to settle on a common case – since `const` constants are always
case-sensitive, it appears that this should be so for define'd
constants.  This would make code as the following to work as expected:

  a.php
  <?php
  const FOO = 'bar';
  ?>

  b.php
  <?php
  define('FOO', 'baz', 1); // => true
  echo FOO; // => bar - WFT?
  ?>

And it obviously would fix a bug.  IMHO, that is sufficient gain for a
presumably moderate BC break.

Please note, that I do not want to pursue a discussion regarding
changing all constants to be case-sensitive or all functions and class
names to be case-insensitive.  Of course, it is fine to discuss it, but
it is clearly out of scope for what I'm trying to improve (in my
opinion) here, which is more in the "a bird in the hand is worth two in
the bush" corner.

If it will be decided that all constant identifiers should be
case-insensitive, I'd be fine with it (not happy, though).  Probably, I
should reword the RFC to reflect that it is actually about deprecation
and removal of the third parameter of `define()` (plus preventing any
extension to register constants which do not conform to the "default"
casing).  In short: don't have two kinds of constants wrt. spelling
(true, false, null are not covered, since they are special anyway and
could be promoted to keywords).

-- 
Christoph M. Becker

-- 
Christoph

---

## #100557 — Tony Marston — 2017-09-13T08:59:43+00:00

URL: https://externals.io/message/100535#100557 · In reply to: #100547

"Sara Golemon"  wrote in message 
news:CAESVnVpUkM_W9xF+0Qt=2M61dGy40gtOehFo=U_F3gd87rmxrQ@mail.gmail.com...
>
>On Tue, Sep 12, 2017 at 5:02 AM, Christoph M. Becker <cmbecker69@gmx.de> 
>wrote:
> > […]
>+0.1 to removing case-insensitive constants, though we'd need to
>define both "null" and "NULL" (similar for true and false) since
>there's little consensus on which version of these constants get used
>from project to project.  Also: While deprecating for 7.3 is fine, I'd
>favor waiting for 8.0 for full removal.
>
>As to François' suggestion to make the whole language case-sensitive?
>Yeesh, that feels like a much more aggressive movement.  In the case
>of constants they very nearly are case-sensitive only since, as you
>point out, common practice is to not pass true for that third
>parameter, and to prefer `const` over `define` anyway.  Identifiers
>are another matter since they're insensitive by default.
>
>In the case of classnames I could almost get on board since
>autoloading standards have pushed users naturally in the direction of
>respecting case sensitive as a coding standard.  I don't feel as
>though that's true of functions or of projects where autoloaders
>aren't used (not a small number).

You seem to forget that autoloading is an option, not a requirement. I don't 
use autoloading in my 14 year old framework for several reasons:
- An autoloader did not exist when I created my framework.
- I built an alternative mechanism into my framework, so I don't need an 
autoloader.
- I don't like the way autoloaders work - all my class names are in snake 
case (lowercase with underscore separators) and the autoloader converts '_' 
into '/' thus producing a file path which does not exist.

By convention I always use uppercase for constants which makes them 
instantly recognisable in my code as all other names are either completely 
lowercase or mixed case. Making constants case sensitive instead of 
insensitive would not affect me.

However, I would be totally against switching the rest of the language to be 
case sensitive for the following reasons:
- It would be a huge BC break no little or no benefit.
- It would allow developers to shoot themselves in the foot by having 
different functions with the same name but different mixtures of case, so 
that foo(), Foo() FOO() and fOO() would be treated as different functions.
- if people move from keyboard input to speech recognition, then simply 
speaking a name would not work - you would have to spell it out character by 
character, and specify either upper or lowercase for each character.

People who think that case sensitive software is cool are deluding 
themselves. When I started working on mainframe computers (UNIVAC and IBM) 
in the early 1970s everything was case-insensitive. This was only changed by 
people who did not understand the ramifications of their choice.

-- 
Tony Marston

---

## #100558 — Ryan Pallas — 2017-09-13T13:15:43+00:00

URL: https://externals.io/message/100535#100558 · In reply to: #100557

On Wed, Sep 13, 2017 at 2:59 AM, Tony Marston <TonyMarston@hotmail.com>
wrote:

>
> > […]
> You seem to forget that autoloading is an option, not a requirement. I
> don't use autoloading in my 14 year old framework for several reasons:
> - An autoloader did not exist when I created my framework.
> - I built an alternative mechanism into my framework, so I don't need an
> autoloader.
> - I don't like the way autoloaders work - all my class names are in snake
> case (lowercase with underscore separators) and the autoloader converts '_'
> into '/' thus producing a file path which does not exist.
>

I must be missing something, there is no autoloader shipped with PHP. You
have to define your own and register it. You can choose to change _ into /
within your autoloader, but that is entirely preference and not
specifically part of autoloading. For example, here's my autoloader which
does no such symbol replacement https://pastebin.com/rQRrXzCa


>
> By convention I always use uppercase for constants which makes them
> instantly recognisable in my code as all other names are either completely
> lowercase or mixed case. Making constants case sensitive instead of
> insensitive would not affect me.
>
> However, I would be totally against switching the rest of the language to
> be case sensitive for the following reasons:
> - It would be a huge BC break no little or no benefit.
> - It would allow developers to shoot themselves in the foot by having
> different functions with the same name but different mixtures of case, so
> that foo(), Foo() FOO() and fOO() would be treated as different functions.
> - if people move from keyboard input to speech recognition, then simply
> speaking a name would not work - you would have to spell it out character
> by character, and specify either upper or lowercase for each character.
>

This is about deprecating the third parameter in define, so userland
constants defined by this function cannot be case insensitive. As mentioned
before by Christoph this is not an attempt to change case sensitivity for
other identifiers (functions, classes, etc) even if it was brought up
before. That is not his intention here, and we need to stick to the focus
of this RFC.


> People who think that case sensitive software is cool are deluding
> themselves. When I started working on mainframe computers (UNIVAC and IBM)
> in the early 1970s everything was case-insensitive. This was only changed
> by people who did not understand the ramifications of their choice.
>
> --
> Tony Marston

---

## #100559 — Rowan Collins — 2017-09-13T13:48:38+00:00

URL: https://externals.io/message/100535#100559 · In reply to: #100551

Regards,

>On Tue, Sep 12, 2017 at 11:59 AM, Rowan Collins
><rowan.collins@gmail.com> wrote:
> > […]
>own,
> > […]
>class, and a constant, it can still *potentially* be any of the three,
>from the point of view of the compiler.
>
>If it's known, it's known, and it can proceed with that type. If it's
>not known then autoload and proceed like normal. I fail to see how
>this is an issue, and in fact, see it as a *significant* improvement
>to our current situation...


If the symbol tables had always been unified, I guess you could think of a function name as a constant whose value happened to be of type IS_FUNC - like how in JS "function foo() {}" and "var foo = function{}" are very nearly interchangeable. But it feels like retrofitting that onto the existing language would be messy.

For instance, an autoloader would have to be given a token name, with no context of whether it's expected to be a class, function, or constant. (Of course we'd have to solve the dilemma of how global function fallback/shadowing should interact with autoloading first.) Users would have to learn this concept of an untyped token, because the error message they'd get if it wasn't defined could no longer say "undefined constant".

Then there's all the existing support for string-based callables. I can't actually think of any cases that are unresolvable, but there's some odd implications:

function foo() { echo 'Hello, world!'; }
const bar='foo';
$fn = bar;
$fn(); // already works
bar(); // would this work? if not, why not, since it's no longer ambiguous?
const baz='bar';
$fn2 = baz;
$fn2(); // in which case, would this also work?
baz(); // and then what about this?

I feel like this could lead to confusion either way, and just increase the complexity for both human and machine analysis.

Then there's other symbol tables that would need to be unified - we'd want $foo->bar be able to grant a method reference, and Foo::bar a static method reference. Just how much code is it worth breaking to allow this syntax?

It feels a lot cleaner to say "function and class references are a new concept, and you'll know when you're using them because they look like this". Something like "SomeClass::classref", "some_func::funcref", "SomeClass::someStaticMethod::funcref", "$some_object->someMethod::funcref".
 
-- 
Rowan Collins
[IMSoP]

---

## #100560 — Lester Caine — 2017-09-13T13:59:51+00:00

URL: https://externals.io/message/100535#100560 · In reply to: #100557

> People who think that case sensitive software is cool are deluding
> themselves. When I started working on mainframe computers (UNIVAC and
> IBM) in the early 1970s everything was case-insensitive. 

Life was so much easier when using an RTTY as the keyboard and printer.
No one had invented the shift key and the 5 bit character set was easy
to work with.

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

---

## #100561 — Rowan Collins — 2017-09-13T14:06:25+00:00

URL: https://externals.io/message/100535#100561 · In reply to: #100558

>I must be missing something, there is no autoloader shipped with PHP.

Just to be pedantically correct, there actually is an implementation shipped, see http://php.net/spl_autoload It's even the default if you don't pass your own function to spl_autoload_register.

Nonetheless, you are quite right that Tony's complaint is nonsensical, because he could implement whatever autoloader suited his directory structure, if he wanted to - even a case insensitive one.

It is true that autoloading isn't mandatory, but it's also a complete straw man, because Sara already made the same point herself:

> I don't feel as though that's true of ...
> projects where autoloaders
> aren't used (not a small number).

Regards,

-- 
Rowan Collins
[IMSoP]

---

## #100562 — Levi Morrison — 2017-09-13T15:16:47+00:00

URL: https://externals.io/message/100535#100562 · In reply to: #100557

> People who think that case sensitive software is cool are deluding
> themselves. When I started working on mainframe computers (UNIVAC and IBM)
> in the early 1970s everything was case-insensitive. This was only changed by
> people who did not understand the ramifications of their choice.

Actually there are concrete bugs caused by case insensitivity. For one
example, here is our own bugs.php.net report about a Turkish locale
issue:

    https://bugs.php.net/bug.php?id=18556

The short summary of the issue is that when capital `I`, the ninth
letter of the English alphabet, is lowercased in the Turkish locales
it does not become the same `i` as it does in English but a different
i that is not considered equal. Thus classes such as `Iterator` are
not found in the Turkish locales. Note that this bug was fixed, and
then there was a regression that lasted until PHP 5.5.

There are other case insensitivity bugs but this Turkish one is the
poster child and if you search around you can find many examples of
it.

Case sensitivity is thus *a correctness issue* and not a "cool"ness,
personal preference, performance, or some other type of issue. I argue
correctness and maintenance issues are the most important and thus if
we change sensitivity of *any* type of symbol it should go in the
direction of being case sensitive. Someone can disagree on what they
value but people who think case insensitivity is not a correctness
issue "are deluding themselves".

Levi Morrison

---

## #100563 — Ryan Pallas — 2017-09-13T15:50:29+00:00

URL: https://externals.io/message/100535#100563 · In reply to: #100561

On Wed, Sep 13, 2017 at 8:06 AM, Rowan Collins <rowan.collins@gmail.com>
wrote:

> On 13 September 2017 14:15:43 BST, Ryan Pallas <derokorian@gmail.com>
> wrote:
> > […]
>
> Just to be pedantically correct, there actually is an implementation
> shipped, see http://php.net/spl_autoload It's even the default if you
> don't pass your own function to spl_autoload_register.
>

Almost 2 decades in PHP, and still so much I don't know haha. I will point
out though, that according to a comment [1] it does not replace the
underscores with slashes as mentioned, and I see no where in the code [2]
that it does either.

[1] http://php.net/manual/en/function.spl-autoload.php#98762
[2] https://github.com/php/php-src/blob/master/ext/spl/php_spl.c#L306


>
> Nonetheless, you are quite right that Tony's complaint is nonsensical,
> because he could implement whatever autoloader suited his directory
> structure, if he wanted to - even a case insensitive one.
>
> It is true that autoloading isn't mandatory, but it's also a complete
> straw man, because Sara already made the same point herself:
>
> > […]
>
> Regards,
>
> --
> Rowan Collins
> [IMSoP]

---

## #100564 — Tony Marston — 2017-09-13T16:03:47+00:00

URL: https://externals.io/message/100535#100564 · In reply to: #100562

"Levi Morrison"  wrote in message 
news:CAFMT4NrC43y-nL_V85qt7JgV1ohM0y4KExhB4e3mi1EjHJ0hBw@mail.gmail.com...
>
>On Wed, Sep 13, 2017 at 2:59 AM, Tony Marston <TonyMarston@hotmail.com> 
>wrote:
> > […]
>
>Actually there are concrete bugs caused by case insensitivity. For one
>example, here is our own bugs.ph p.net report about a Turkish locale
>issue:
>
>    https://bugs.php.net/bug.php?id=18556
>
>The short summary of the issue is that when capital `I`, the ninth
>letter of the English alphabet, is lowercased in the Turkish locales
>it does not become the same `i` as it does in English but a different
>i that is not considered equal. Thus classes such as `Iterator` are
>not found in the Turkish locales. Note that this bug was fixed, and
>then there was a regression that lasted until PHP 5.5.
>
>There are other case insensitivity bugs but this Turkish one is the
>poster child and if you search around you can find many examples of
>it.
>
>Case sensitivity is thus *a correctness issue* and not a "cool"ness,
>personal preference, performance, or some other type of issue. I argue
>correctness and maintenance issues are the most important and thus if
>we change sensitivity of *any* type of symbol it should go in the
>direction of being case sensitive. Someone can disagree on what they
>value but people who think case insensitivity is not a correctness
>issue "are deluding themselves".
>
>Levi Morrison

I'm sorry, but errors in translation from one character set to another are 
insignificant when compared with the much larger problem of the same word 
having diferent meanings depending on case. In the English language "info" 
is the same as "Info" is the same as "INFO" is the same as "iNFO" is the 
same as "iNfO" and so on. If the problem is that an English word cannot be 
recognised as the same word regardless of case when switching to a 
non-English character set then the issue is with switching to a non-English 
character set.

Introducing case sensitivity just for this minor bug would create more 
issues than it would solve, so this bug should be solved using a different 
technique .

-- 
Tony Marston

---

## #100565 — Tony Marston — 2017-09-13T16:12:56+00:00

URL: https://externals.io/message/100535#100565 · In reply to: #100558

"Ryan Pallas"  wrote in message 
news:CAObuZdtmhxQ285hwMc3x9TH2rj9D7Ty3vnhNPcBzdCePpch9YA@mail.gmail.com...
>
>On Wed, Sep 13, 2017 at 2:59 AM, Tony Marston <TonyMarston@hotmail.com>
>wrote:
>
> > […]
>
>I must be missing something, there is no autoloader shipped with PHP. You
>have to define your own and register it. You can choose to change _ into /
>within your autoloader, but that is entirely preference and not
>specifically part of autoloading. For example, here's my autoloader which
>does no such symbol replacement https://pastebin.com/rQRrXzCa
>
>

Then it must have been the project I was working on which used a combination 
of Codeigniter, Composer and PHPUnit. There was definitely something which 
translated a class name from "foo_bar_snafu" into "foo/bar/snafu". It's no 
wonder that I stopped using it.

-- 
Tony Marston

http://www.tonymarston.net
http://www.radicore.org

---

Next page: https://externals.io/message/100535.md?page=2
