Decouple classes from their file names

Continuing the discussion from Is it .lc or .lucee?:

With a view to that, I have raised LDEV-409:

Currently classes are identified by their file name.
It might be better to just be able to name them:

// doesNotMatterWhatTheFileNameIs.lucee
class SomeThing {


// test.lucee
myThing = new SomeThing();

This is how it generally works in most languages, I think?



I like the filename coupling. I always know where my error is occurring.

1 Like

More than just that, languages that start from this point end up requiring some sort of naming convention for class files (ex. PHP). This is built into the CFML language already, and feels more like Java in that regard.

Well, two things on that:

  1. PHP has a coding standard (PSR-0 & now PSR-4) for autoloading classes which leverage a standardised naming method, but it’s not a requirement. Classes don’t even have to go in separate files in PHP.
  2. Java’s behaviour is not that cut and dried either. Only public classes need to be in a file of the same name as the class.

And in both languages the classes have specific names, eg:

class Foo { // the class name is *not* derived from the file name


Class names and file names are discrete things, however in some situations there are conventions or restrictions applied to the two when used in conjunction with each other.