RE: Cabal: Conditional code and dependencies

I haven't had time to think about the other points in your message yet, but wanted to comment on this one: On 21 July 2005 06:32, Brian Smith wrote:
(3) It would be useful if Cabal/GHC/Hugs/etc. #defined symbols for installed packages. This would allow us to write:
module My.Program.Compat.Lib(foo1, foo2,foo3) #if __PACKAGE_foo__ >= 110 -- Is package foo-1.1 or later available? import Foo(foo1,foo2,foo3) #else
foo1 = .... foo2 = .... foo3 = ...
#endif
Absolutely - this thought also crossed my mind recently. We should agree on a convention. __PACKAGE_<name>__ seems reasonable, but what about the version number? We could adopt the same policy as __GLASGOW_HASKELL__, namely major*100+minor, and discard any futher dimensions in the version number (e.g. 1.1.1 and 1.1.2 both get __PACKAGE_foo__==101). This perhaps isn't as intuitive as it could be: people tend to write 110 when they want 101. So is there an alternate/better scheme? Cheers, Simon

"Simon Marlow"
#if __PACKAGE_foo__ >= 110 -- Is package foo-1.1 or later available?
Absolutely - this thought also crossed my mind recently. We should agree on a convention. __PACKAGE_<name>__ seems reasonable, but what about the version number? We could adopt the same policy as __GLASGOW_HASKELL__, namely major*100+minor, and discard any futher dimensions in the version number (e.g. 1.1.1 and 1.1.2 both get __PACKAGE_foo__==101). This perhaps isn't as intuitive as it could be: people tend to write 110 when they want 101. So is there an alternate/better scheme?
Intuitively, I think many people use this formula: read . take 3 . filter isDigit . (++"000") So version numbers would translate roughly like: 1 100 1.0 100 1.1 110 1.1.1 111 1.1.2 112 1.12 112 1.12.1 112 Although this is ambiguous, my feeling is that in projects using major.minor.smaller, the minor number tends not to rise above 9, and conversely, if a project's minor number rises above 9, it tends only to use two levels of numbering not three. Regards, Malcolm

On Thu, Jul 21, 2005 at 11:59:41AM +0100, Malcolm Wallace wrote:
"Simon Marlow"
writes: Intuitively, I think many people use this formula:
read . take 3 . filter isDigit . (++"000")
So version numbers would translate roughly like:
1 100 1.0 100 1.1 110 1.1.1 111 1.1.2 112 1.12 112 1.12.1 112
Although this is ambiguous, my feeling is that in projects using major.minor.smaller, the minor number tends not to rise above 9, and conversely, if a project's minor number rises above 9, it tends only to use two levels of numbering not three.
Doesn't that make 1.9 > 1.10 whereas I think the opposite is true with cabal? Thanks Ian
participants (3)
-
Ian Lynagh
-
Malcolm Wallace
-
Simon Marlow