Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How so?


If there are multiple files in a wildcard pattern, what order are they resolved? I know for classpath loading, for example, it’s in directory order, which is file system dependent, and often based on the order the files were written to the directory and/or the size of the directory inode. Lots of fun figuring out why the wrong version of a class is consistently loaded on one or two servers out of twenty. (Always check your classpaths for duplicates kids.)


> If there are multiple files in a wildcard pattern, what order are they resolved

If you don't care (eg [0]) then do nothing and let the user bang it's head and reinvent the wheel.

If you care - just sort it and mark it as 'platform dependent' or somehow. Nobody really cares for the exact rules and a simple \d\d\-\w+\.conf pattern for the filenames is more than enough in 99% of cases.

[0] https://www.zabbix.com/documentation/6.0/en/manual/appendix/...


Oh yes! Good thing if it only happens in the build server and not on deployments, but that can be "fun" enough. Bonus points if you have a culture of repeat builds being "special".


I've always seen this solved by sorting (lexicographical order of bytes, originally). First two characters were digits, for all files within a wildcard directory.


> Always check your classpaths for duplicates kids.

I recently discovered extra-enforcer-rules which can help with that, as long as your classpath comes from Maven dependencies.


Because "first" and "last" don't convey priority. You have to know how the configuration parser works with defaults and overrides. Does the parser stop reading after the first match? Do later configuration directives override previous ones or are they appended to them, and if they are appended, in which order are they evaluated?


First and last are only ambiguous if we make the order ambiguous though. There's no reason for the order to be ambiguous, and if it is then obviously we can't use first/last. I don't think that first/last are either ambiguous or implementation dependent concepts. The other questions are simply other questions, and aren't directly related to whether the ordering is ambiguous or not.

There are plenty of applications that read a set list of configuration files and use either the first or last setting found. I agree with the responder that the last setting usually makes more sense.


> and if they are appended, in which order are they evaluated?

This would be a problem for first wins too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: