mirror of
https://github.com/not-kennethreitz/convore.json.git
synced 2026-06-05 23:20:19 +00:00
1 line
2.4 KiB
JSON
1 line
2.4 KiB
JSON
[{"user_id": 7559, "stars": [], "topic_id": 4552, "date_created": 1297528240.6288559, "message": "This has been bugging me lately. Most frameworks use the autoload function, but I use a top-level namespace \\import() function to load files and then I have class methods that load specific types of file using the import. They seem the same performance wise, and there's no question where a file is located, plus I can design the file structure in a more developer friendly manner.", "group_id": 499, "id": 87059}, {"user_id": 7559, "stars": [], "topic_id": 4552, "date_created": 1297528423.782531, "message": "I understand the ease of use for autoload, but I don't like how there can only be a single autoload function to rule them all. I think it makes code harder to read when you are trying to drill down to what is making up the pieces. Personally I think autoload should work on a per namespace basis, but that is just my opinion.", "group_id": 499, "id": 87066}, {"user_id": 8981, "stars": [], "topic_id": 4552, "date_created": 1297632384.8954909, "message": "There can be multiple autoload functions, see http://php.net/spl_autoload_register", "group_id": 499, "id": 93833}, {"user_id": 7559, "stars": [], "topic_id": 4552, "date_created": 1297643708.004853, "message": "@lastkarrde True, but spl loops through the autoloaders until it finds one that works. I was saying we need a way to specify the autoloader for a particular namespace. If I'm working in \\ and instantiate \\data\\filter\\string() then PHP would check for an autoloader registered for \\data\\filter, \\data\\, or \\. But you are correct, I could use SPL to register autoloaders and let it drill down until it found a match. Unfortunately I like to make folders and file names a little more user friendly and use the namespaces as a descriptor of the purpose of the class. \\data\\filter\\string would be located in /data/filters/string.php or even /data/filters.php", "group_id": 499, "id": 94937}, {"user_id": 11277, "stars": [], "topic_id": 4552, "date_created": 1298530132.729414, "message": "@DDyess That really seems like asking for trouble. If you want user friendliness from a file layout, why not just map classnames predictably to a directory structure? You'll save yourself the implementation complexity and overhead of multiple or special-case-heavy autoloader functions, and other programmers a lot of hassle figuring out where files live...", "group_id": 499, "id": 195838}] |