2024/11/01

Newest at the top

2024-11-01 15:42:54 +0100 <EvanR> now while c_pi doesn't change over time, some people still think c changes over time (c being the speed of light)
2024-11-01 15:42:29 +0100 <mauke> the presence of the initializer makes it a definition, and modifying an object whose definition includes 'const' is UB
2024-11-01 15:41:58 +0100 <mauke> EvanR: you're right, I misremembered
2024-11-01 15:40:31 +0100vgtw(~vgtw@user/vgtw) vgtw
2024-11-01 15:40:26 +0100 <EvanR> unless nothing means anything, which I guess is one way to look at things
2024-11-01 15:40:10 +0100 <EvanR> "const means nothing" is just false
2024-11-01 15:40:09 +0100 <merijn> (or on non-embedded I suppose)
2024-11-01 15:39:59 +0100 <merijn> mauke: Which of course in embedded doesn't prevent an address from changing in memory mapped IO
2024-11-01 15:39:34 +0100 <merijn> mauke: Pretty sure const *is* "modification = UB"
2024-11-01 15:39:26 +0100vgtw(~vgtw@user/vgtw) (Ping timeout: 255 seconds)
2024-11-01 15:39:21 +0100 <merijn> mauke: Sure, but you're not permitted to write to that
2024-11-01 15:39:05 +0100 <EvanR> you can say that values in haskell change over time
2024-11-01 15:38:29 +0100 <EvanR> but like, I can write to any object in haskell too
2024-11-01 15:38:22 +0100 <mauke> I know 'const volatile foo' is explicitly permmitted
2024-11-01 15:38:14 +0100 <EvanR> sure
2024-11-01 15:38:12 +0100 <mauke> hold on, I need to check my standards
2024-11-01 15:38:08 +0100 <merijn> EvanR: C programmers regularly break everything :p
2024-11-01 15:37:49 +0100 <EvanR> unless you break everything, which you can do in haskell also
2024-11-01 15:37:33 +0100 <EvanR> in C, that's a const double, it's not changing
2024-11-01 15:37:31 +0100 <merijn> mauke: because modifying pi is UB
2024-11-01 15:37:18 +0100 <merijn> mauke: tbf, it's actually sound
2024-11-01 15:37:18 +0100 <mauke> const means read-only, not constant
2024-11-01 15:37:10 +0100 <merijn> EvanR: Because const means nothing
2024-11-01 15:37:03 +0100 <EvanR> how does const double pi change over time
2024-11-01 15:36:30 +0100 <mauke> but that's unsound, since the value of pi can change over time
2024-11-01 15:36:18 +0100 <mauke> is documented as letting you refer to const double pi = 3.14;
2024-11-01 15:36:01 +0100 <mauke> huh. foreign import capi "pi.h value pi" c_pi :: CDouble
2024-11-01 15:34:52 +0100 <merijn> It's been a long time xD
2024-11-01 15:34:49 +0100 <merijn> or something
2024-11-01 15:34:44 +0100 <merijn> mauke: There was a case where the import of a variable was ambiguous compared to a function returning a pointer
2024-11-01 15:33:18 +0100 <merijn> can't check right now, since I have no GHC install on this machine
2024-11-01 15:33:09 +0100 <merijn> (IFF you declare the header at the import) but that might be a lie
2024-11-01 15:32:42 +0100 <merijn> mauke: CPP macros is capi only (but you can use both at the same time). The type checking I *thought* it also did for ccall
2024-11-01 15:32:37 +0100 <mauke> importing addresses of variables is in the base FFI
2024-11-01 15:32:13 +0100 <merijn> I'd prefer ccall where possible, but capi is a huge win. I think capi also lets you reference Ptr to variables directly (as opposed to only functions)
2024-11-01 15:32:11 +0100 <mauke> I thought capi was what you were talking about when you mentioned CPP macros and checking against headers
2024-11-01 15:31:20 +0100Square2(~Square4@user/square) (Ping timeout: 255 seconds)
2024-11-01 15:31:19 +0100k_hachig_(~k_hachig@2607:fea8:351d:ef0:901a:fefb:e87f:78b3) (Ping timeout: 260 seconds)
2024-11-01 15:31:16 +0100 <merijn> mauke: capi is nice for some things, though. Since it lets you foreign import CPP macros as values: https://github.com/merijn/Belewitte/blob/ed95965077ee0a55c9a206b75445ddf93723916b/benchmark-analys…
2024-11-01 15:30:54 +0100 <merijn> capi is very different, since it generates stubs instead of calling directly from Haskell
2024-11-01 15:30:37 +0100 <merijn> I thought it did
2024-11-01 15:30:05 +0100 <mauke> I know capi does weird things
2024-11-01 15:29:50 +0100 <mauke> for ccall? are you sure?
2024-11-01 15:29:33 +0100 <merijn> (modulo marshalling as defined in the FFI part of the standard)
2024-11-01 15:29:22 +0100Sgeo(~Sgeo@user/sgeo) Sgeo
2024-11-01 15:29:10 +0100 <merijn> mauke: https://github.com/merijn/Belewitte/blob/ed95965077ee0a55c9a206b75445ddf93723916b/benchmark-analys…
2024-11-01 15:29:07 +0100 <merijn> mauke: It's been awhile, but iirc if you mention the header file on the foreign import it will check that the Haskell type you declare for it corresponds to the C type
2024-11-01 15:28:11 +0100vgtw(~vgtw@user/vgtw) vgtw
2024-11-01 15:28:10 +0100 <mauke> er, yes
2024-11-01 15:27:48 +0100 <merijn> mauke: "can" for the type checking, you mean?