<omegatron>
.. and, it throws two errors while building (about sexplib0 and dune-configurator not found) and fails while installing with "Error: The following <package>.install are missing: - _build/default/base.install"
<omegatron>
but sexplib0 and dune-configurator are installed (verified it twice)
ornxka has joined #ocaml
<ornxka>
hi
<ornxka>
opam install coq-vst.2.9 <- i do this and then in ~/.opam i dont see any .vo files associated with coq-vst
<ornxka>
i see the .v files in .opam/default/.opam-switch/sources/coq-vst.2.9 and i see a folder .opam/default/.opam-switch/packages/coq-vst.2.9
<ornxka>
but i dont see any .vo files
<ornxka>
i also see .opam/default/lib/coq/user-contrib/VST but there are no .vo files in there either.. am i missing something?
YukiSou has quit [Quit: Client closed]
Haudegen has joined #ocaml
gravicappa has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
wyrd has quit [Remote host closed the connection]
wyrd has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
ralu has joined #ocaml
jlrnick has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jlrnick has quit [Ping timeout: 252 seconds]
jlrnick has joined #ocaml
jlrnick has quit [Read error: Connection reset by peer]
mbuf has quit [Quit: Leaving]
mro has joined #ocaml
wingsorc has quit [Ping timeout: 250 seconds]
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ocaml
m5zs7k has quit [Read error: Connection reset by peer]
oisota has quit [Quit: Ping timeout (120 seconds)]
m5zs7k_ has joined #ocaml
oisota has joined #ocaml
m5zs7k_ is now known as m5zs7k
<ns12>
Regarding Unix.write, the docs say " write repeats the writing operation until all bytes have been written or an error occurs". What happens when the write is interrupted by a signal? Will Unix.write automatically deal with the interruption and continue writing from where it left off?
Serpent7776 has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
jlrnick has joined #ocaml
bartholin has quit [Ping timeout: 272 seconds]
mro has joined #ocaml
bartholin has joined #ocaml
jlrnick has quit [Ping timeout: 272 seconds]
mro has quit [Ping timeout: 250 seconds]
Haudegen has quit [Quit: Bin weg.]
<d_bot>
<darrenldl> i am confused by the thread on eio and capabilities on forum: so does capability represent a bound or is it merely a means to passing things around?
<haesbaert>
sadiq: I don't understand why it doesn't continue if errno==EAGAIN and written==0, in that case you throw a an exception of EAGAIN ?
<haesbaert>
well ok it just doesn't want to automatically restart it, nvm sorry for the noise
mro has joined #ocaml
<hannes>
one persons noise is another persons signal ;)
<ns12>
sadiq: The docs say "write repeats the writing operation until all bytes have been written or an error occurs". What kind of error could occur during a write?
<ns12>
Is it some kind of Unix.Unix_error exception?
<ns12>
haesbaert: Yes, but OCaml's Unix.write doesn't behave exactly like POSIX write(). As the docs say: "write repeats the writing operation until all bytes have been written or an error occurs". To my knowledge, POSIX write() does not automatically repeat the writing operation. That is why I am asking.
<haesbaert>
ns12: the thing is that it's valid to return short counts on write, so write(fd, 1024) can return < 1024 and > 0, normally you have to manually write the remainder in a loop, that's what ocaml is already doing for you, in case you get EAGAIN after having at least one sucessfull write, errno is not thrown and you get a partial count
<haesbaert>
ns12: you're correct, it behaves differently.
<haesbaert>
I still think it's kinda odd you can get a partial count if you get a signal during the second+ write.
<haesbaert>
I'd set SA_RESTART so you can escape EAGAIN semantics
Haudegen has joined #ocaml
<ns12>
If I am reading the OCaml source code correctly, Unix.write will always retry the writing operation. The only errors that could occur are EAGAIN and EWOULDBLOCK, which only occur when the file descriptor is a socket that is marked as nonblocking. Is my understanding correct?
<haesbaert>
oh jesus, I'm reading EAGAIN as EINTR, forget all I wrote, my brain is tricking me
<ns12>
From my understanding, this means that it is perfectly safe to ignore the return value of Unix.write if the file descriptor is not that of a nonblocking socket.
<companion_cube>
there's `Unix.single_write`
<haesbaert>
ns12: it will always retry as long as you get a partial (non error case), or EAGAIN/EWOULDBLOCK as long as you haven't written anything
<d_bot>
<antron> i imagine it's supposed to represent a bound, but that depends on how the rest of the api interprets these objects, of course
<haesbaert>
so write(fd, 10) -> error=0,wrote=5, automatically calls a write(fd, 5).
<haesbaert>
but also write(fd, 10) -> error=0,wrote=5, automatically calls a write(fd, 5) -> error=-1,errno=EAGAIN,wrote=5 -> returns 5
<haesbaert>
"if subsequent writes get a EAGAIN, you *still* return a non-error shortcount"
<companion_cube>
tl;dr it's designed to be convenient? :)
<haesbaert>
I guess it makes sense, veyr common for people to only test against -1 in the wild and ignore shortcounts.
<ns12>
EAGAIN only occurs for nonblocking file descriptors, so if I am only using blocking file descriptors, I don't need to deal with that. I think.
<haesbaert>
yeah, unless you have a weird device that uses EAGAIN to signal something else even in blocking mode :P
<ns12>
Okay. Thank you. I think I am satisfied with the explanations.
<haesbaert>
my apologies, I was reading EAGAIN as EINTR
<companion_cube>
is EINTR the one that's triggered by signals?
<haesbaert>
yes
rgrinberg has joined #ocaml
<haesbaert>
and the nyou depend if syscalls are automatically restarted or not, bsd vs linux semantics
<companion_cube>
well I'm glad OCaml takes care of that for me
<haesbaert>
now I'm curious, gotta open the stevens can't remember who did/does what
<haesbaert>
solaris 9 (didn't/doesn't) restart, 4.2BSD always restarted, from 4.3BSD and modern stuff (linux,freebsd,os x), default is to always restart
<sleepydog>
there's a group of syscalls that don't restart, right?
<haesbaert>
yeah, it's divided into "slow and fast", and then select/poll is kinda like a special case
<sleepydog>
ah, signal(7) spells it out
rgrinberg has quit [Remote host closed the connection]
mro has quit [Remote host closed the connection]
<haesbaert>
I got the habit of if (n == -1 && errno == EAGAIN) goto again;
<haesbaert>
cause I can never remember them
rgrinberg has joined #ocaml
<sleepydog>
i would have preferred that Unix.single_write was Unix.write, and Unix.write were something else like write_all or 'really_write' (borrowing from Stdlib's really_input)
<haesbaert>
I see merit in that, but honesly silently fixing 90% of short counts might actually be the right thing
mro has joined #ocaml
olle has joined #ocaml
<d_bot>
<VPhantom> I was pleasantly surprised to discover that behavior being standard. One less thing to worry about.
mro has quit [Remote host closed the connection]
<haesbaert>
IIRC bsd had a counter in netstat ip for write short counts on ip sockets
mro has joined #ocaml
mro has quit [Remote host closed the connection]
<d_bot>
<darrenldl> antron: then yeah i don't think there is much merit from security point of view as you've pointed out
spip has joined #ocaml
bobo has quit [Ping timeout: 252 seconds]
<d_bot>
<antron> im not sure if i misunderstood you, since i understood bounds to be the option with the greater merit 🙂
<d_bot>
<darrenldl> as in i don't think they provide a meaningful bound if that was the intention
<d_bot>
<darrenldl> since we lack a "monitor" of sorts to constrain the process anyway
<d_bot>
<antron> however either way i think there is ultimately no real merit. even emily (iirc), the system cited from 2006, consisted of a restriction of ocaml to a very specific set of apis, together with a static analyzer for enforcing this restriction. an ocap system in ocaml without a static analyzer is largely meaningless from the point of view of security, in that while it might seem to add "safety" in an empty theoretical setting, you wou
<d_bot>
<antron> yep
<d_bot>
<antron> and on the other hand ocaml could not get emily's static analyzer since as i had always understood it, that analyzer simply disallowed most "real" ocaml code
<companion_cube>
maybe we should also resurrect jocaml 🤔
<d_bot>
<darrenldl> in face of RCE, input injection, logical error, the static analyzer needs to be ridiculously smart
<d_bot>
<antron> so if ocaml were equipped with some kind of static analyzer, it would have to be something different from emily's, unless we are planning some very radical changes to the ecosystem 🙂
<d_bot>
<antron> that's why my question about actual future plans on this front was important, and i was very disappointed that the answer was just to point to emily since the emily work is an interesting PoC but does not actually apply or have much relevance for the real ocaml situation
<d_bot>
<antron> and is not a future plan but a past academic project
<d_bot>
<antron> since there are no such plans around to my knowledge, that means paying costs of ocap, while only getting ocap's extremely minimal incremental benefit, and even if there were such plans, the question is how many years until they are implemented. it might still not be worth paying for that long
<companion_cube>
I'd hate to get to OCaml 5.0 just to be told "a few more years and we'll be there"
<d_bot>
<antron> Thomas did appear to concede that ocap programming is pleasant (an opinion i don't share) and it is easier to verify correct programs, but the latter benefit is so minimal compared to just the pervasive oppression of systematic mandatory ocap, including to beginners
<companion_cube>
I'm baffled that people want access to directories to be painful
<d_bot>
<antron> even the README concedes that ocap is not that useful without some kind of language change, but then waves Emily to dismiss that
<d_bot>
<darrenldl> one immediate problem that popped into my head when reading the thread where a whitelisted directory is passed in an example, is that ocaml would not have means to understand aliases of resources at the system level (soft/hard links for instance)
<d_bot>
<darrenldl>
<d_bot>
<darrenldl> this is often the major source of headache for sandboxing, and i don't know how Eio handles that
<companion_cube>
you can't sandbox from within OCaml
<companion_cube>
the one good example of capabilities we've discussed is capsicum, afaict
<d_bot>
<darrenldl> i mean that's the issue with the supposed bounds
<companion_cube>
and it does it at the syscall level
<d_bot>
<antron> that's in line with my argument that for any useful properties, the ocaml function and module boundary is the wrong boundary to look at. it should be the OS process or sandbox boundary
<d_bot>
<darrenldl> if they are not bounds then why are they called bounds
<d_bot>
<darrenldl> yep 100%
<companion_cube>
@antron probably the mirage people are used to both being the same
<companion_cube>
1 process, 1 kernel, 1 program
<d_bot>
<antron> yeah
<d_bot>
<antron> in a very different language and ecosystem you may be able to get useful properties with function boundary reasoning
<d_bot>
<darrenldl> i mean function is the only boundary in mirage : D
<d_bot>
<antron> completely agree hence why this is really not about any of the other properties, those are red herrings. this is really about mirage, from mirage, for mirage
<companion_cube>
honestly? I don't think any language will do that
<companion_cube>
*maybe* deno, because it has capabilities from the start, adn V8 is actually talking via RPC to the part that does sycalls
<companion_cube>
so V8 is isolated from the system in a very real way
<companion_cube>
but OCaml, with C externals, unix, etc.? lol
<d_bot>
<antron> ocap feels good and function-y and that attracts people naturally (including me) but those benefits go away when you consider the facts in more detail, including the existence of containers, the actual Emily report and its static analyzer, the actual statements made, and you are left only with the engineering reality that this is about mirage
<d_bot>
<darrenldl> companion_cube: as a digression, a security policy generating library similar to how capsicum works (if my memory serves), where ocaml code nominates access to give up, could be interesting
<companion_cube>
just give us pledge()
<d_bot>
<Bluddy> it makes no sense to suggest something that the whole community desires, only to use it to force the community to accept a controversial addition few actually want
<d_bot>
<Bluddy> unless you just want this piece of code to sit in a museum
<d_bot>
<Bluddy> companion_cube: your suggestion to define some common effects is spot on. we have a potentially infinite "monad stack" in effects, and we need to pin down the "monads"
<companion_cube>
yes
<companion_cube>
that's what the fucking stdlib should be for
mro has joined #ocaml
<companion_cube>
define common grammar, let people build on that
<d_bot>
<darrenldl> companion_cube: if epbf and pledge share enough of the features, perhaps a crossplatform pledge of sorts can be made into a package hmmm
<d_bot>
<Kakadu> opam-related question. Do I understand right that these versions should be ordered like this: "0.3~" <= "0.3~alpha1" <= "0.3" ?
<d_bot>
<antron> i can confirm the right-most inequality
<d_bot>
<antron> (which is strict, <)
zebrag has joined #ocaml
<haesbaert>
companion_cube: are you talking openbsd's pledge ?
<companion_cube>
in the interest of transparency, I know of it only because of serenityOS :D
<haesbaert>
oh cool, didn't know they had it, seems the same thing
<d_bot>
<darrenldl> i was surprised to find serenity adding it when i googled : D
<haesbaert>
I remember when we started moving the openbsd base to use pledge
<haesbaert>
it's really well designed imho
<companion_cube>
they added it after being gently pwned :D
<haesbaert>
? you mean the opensmtpd bug ?
<companion_cube>
no, just, serenityOS added that after a conference pointed out they had a lot of security issues iirc
<haesbaert>
ahh, I thought you were referring to openbsd :)
<companion_cube>
I don't know much about openBSD, sorry :(
<haesbaert>
it's fun and slow, that's all there is to know :)
<d_bot>
<VPhantom> If anyone's familiar with `Printf`: is there an elegant way to specify the _maximum_ length of a float conversion? …or do I have to figure out the size of the integer part to and generate a format string that has an explicit number of decimals?
<companion_cube>
%.2f
<d_bot>
<VPhantom> Nope.
<haesbaert>
companion_cube: I used to be @openbsd.org
<d_bot>
<VPhantom> Nice try, though. 😉
<companion_cube>
what do you want exactly?
<companion_cube>
%.2f does work to limit to 2 decimals
<sleepydog>
you want it to be potentially less than 2 decimals when applicable?
<d_bot>
<antron> %2f
<d_bot>
<antron> does that work?
<d_bot>
<VPhantom> Suppose I have a maximum length of `6` and the number `123.66666667` I want `"123.67"`.
<sleepydog>
oh, gosh. i don't think so
<d_bot>
<antron> %6f
<companion_cube>
oh, all included. I'm not sure
<companion_cube>
what if you have 123456789.1 ?
<d_bot>
<antron> ah it's minimal width
<companion_cube>
would you want scientific notation then?
<d_bot>
<VPhantom> Thought so. So I'll have to extract the integer part to get its size, then do `max - that - 1` and that's my decimal width for the format string.
<d_bot>
<VPhantom> Nope, this is a format from the 1970s, only digits and a possible period.
<sleepydog>
Fmt module might have something
<d_bot>
<antron> do opam and ocaml run on serenity?
<companion_cube>
it's the same formatting for floats, sleepydog
<companion_cube>
@antron I doubt so :s
<companion_cube>
someone would need to do the work of porting at least ocamlrun
megeve has quit [Ping timeout: 240 seconds]
<d_bot>
<idnes> anything for time-series analysis?
<d_bot>
<idnes> i mean, any lib
megeve has joined #ocaml
<sleepydog>
Fmt.float_dsig -- won't this do it?
<d_bot>
<VPhantom> (Ah, the standard technically supports exponential notation, but only "recent'y (1998).
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<d_bot>
<octachron> `%.6g` will restrict the number of significant digits but it will switch to scientific notation when needed.
<companion_cube>
@octachron I'm impressed with your knowledge of such fine details
<companion_cube>
also fun, btw: %h for hexadecimal float notation :)
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<d_bot>
<VPhantom> Yeah I thought of `g` but I'd be one short when there's no decimal period.
<d_bot>
<octachron> Well, that's the format used by the toplevel printer (with a twist).
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
rgrinberg has quit [Ping timeout: 250 seconds]
Haudegen has quit [Quit: Bin weg.]
bartholin has quit [Quit: Leaving]
mro has quit [Remote host closed the connection]
sagax has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Read error: Connection reset by peer]
<d_bot>
<RegularSpatula> For example, I have cram tests that check that my CLI apps handle files that don't exists properly...but when using cmdliner, doing triggers an error message generated by cmdliner, which Daniel has asked to avoid
<d_bot>
<RegularSpatula> I was thinking of making a dune alias that runs most of the tests (but not the ones that depend on cmdliner output), then using the `*.opam.template` file to make sure that opam builds and tests the package using the custom test alias rather than the default `@runtest` one...but is that the best way to do it?
<d_bot>
<darrenldl> use return code instead?
<OCamlPro[m]>
<léo> you could just check the exit code instead of the message, no ?
<companion_cube>
do cram tests allow for `...` ellipsis, like mdx does?
<rgrinberg>
What's ... in mdx?
<companion_cube>
it skips any number of lines
<companion_cube>
so you can skip some parts of the output
<companion_cube>
and only match the relevant/fixed parts
<d_bot>
<RegularSpatula> I generally process output with `sed` or whatever unix commands...I thought of doing this, but I think the idea is to avoid depending on any text output of cmdliner since it could change version to version which leads to troubles for the CI people
<d_bot>
<RegularSpatula> Returns codes could work i suppose, but then I would need to be disciplined about actually returning useful return codes rather than 1 for every failure...
<d_bot>
<darrenldl> is it triggered cause of runtest stanza?
<d_bot>
<RegularSpatula> you mean the cram tests that depend on cmdliner error output?
<d_bot>
<darrenldl> yep
<d_bot>
<darrenldl> (im very rusty on how opam ci works
<Corbin>
darrenldl, antron: In general, retrofitting languages for capability-safety doesn't work. It's painful. There's a great analogy to memory-safety, which also can't just be a retrofit.
<Corbin>
companion_cube: It's not about pain. It's about structured access to authority.
<companion_cube>
it's very much about pain
<d_bot>
<RegularSpatula> darrenldl: the `runtest` alias gets run inside the `build` section of the opam file, and that is the part that tells opam how to build it...so i assume (maybe incorrectly) that that is also how the CI will try to build it
<d_bot>
<darrenldl> oh right - had to remind myself of opam file structure
<d_bot>
<darrenldl> i thought dune buils doesnt trigger runtest though
<d_bot>
<darrenldl> build*
<companion_cube>
it's because opam-ci runs tests, too
<d_bot>
<darrenldl> oh
<companion_cube>
they install packages with various versions of the dependencies, with -t, with doc enabled, etc.
<d_bot>
<darrenldl> (notes that down to make sure i dont define runtest...)
olle has left #ocaml [#ocaml]
<d_bot>
<darrenldl> TIL
<d_bot>
<darrenldl> Corbin: asking from a different angle - is there a language designed from ground up with capability safety in mind that has seen at least some non-trivial uses?
<companion_cube>
I was going to say Pony, but… serious uses? oops
<rgrinberg>
companion_cube no, you must use sed,awk,cut etc
<companion_cube>
ah I see.
<Corbin>
darrenldl: I can respond along companion_cube's lines, but I want to point out that the simply-typed lambda calculi are all capability-safe *by default*. They lose the safety when we add features that break encapsulation, taming, etc.
<companion_cube>
we don't write code in lambda calculus
<Corbin>
And that's why you don't get capability-safety by default~
<companion_cube>
or at all
<d_bot>
<darrenldl> re pony: oh right it does capability, i only remember it for the concurrency
Haudegen has joined #ocaml
<companion_cube>
it's also immensely complex
<d_bot>
<darrenldl> yeah i dont know, it reads nice when you dont make explicit the threat model at least i guess
<Corbin>
Monte was explicitly designed to have entrypoint capabilities gathered into a single point for each application. As a result, we can directly read what dangerous things it can do from its source code.
<companion_cube>
I'm glad for you
<Corbin>
Unlike pledge(), this is a *positive* enumeration, not a negative.
<companion_cube>
I also notice that this forces you to write the rest of the code in the scope of `main`
<companion_cube>
not exactly what I'd do in a larger program
<companion_cube>
and the point is moot, we're talking about OCaml which is *not* safe
<Corbin>
Nah, I was just lazy. Monte modules must be DeepFrozen, or transitively immutable at top level; they can't hold mutable state.
<Corbin>
OCaml's not that unsafe, though. It's mostly builtin stuff that isn't tamed. There's objects, I guess, but few folks use objects.
<companion_cube>
there's C bindings, globals, mutation
<Corbin>
Mutation can be okay! It just requires a lot of careful design. Like, you can't have mutation, coroutines, and reentrancy-safety all at once. Erlang got rid of mutation, which is a viable path too.
<Corbin>
Globals gotta go, though. Ditto with user-controllable C bindings. You can pre-bind useful C libraries (e.g. Monte binds libsodium), but every C library increases the TCB.
Armael has left #ocaml [WeeChat 3.0]
Armael has joined #ocaml
Armael has left #ocaml [WeeChat 3.0]
<pgiarrusso>
Corbin: why do you object to mutation with the other stuff? What next, will you object to mutation + backtracking? :-)
<pgiarrusso>
Coq mixes them “just fine” without any bugs </s>
<Corbin>
pgiarrusso: Plan interference, as explained in http://www.erights.org/talks/promises/paper/tgc05.pdf, requires some sort of mutation. Pony has some sort of coroutine subsystem which limits mutation, and they claim to have fixed the reentrancy and interference problems too.
<pgiarrusso>
Sorry, I was mostly confirming OCaml’s unsafety via a joke on Coq
<companion_cube>
Corbin: I'm sorry but what are you talking about
<companion_cube>
you can't get rid of mutation of C bindings in OCaml
<companion_cube>
that ship sailed decades ago, it's a no-go
<Corbin>
companion_cube: Dream a little bigger. Sure, we can't change OCaml *and* force the community to use the changed language. So don't do that! Nonetheless, it's important to understand exactly which mistakes were made in OCaml's design, so that we don't make them again.
gravicappa has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
<companion_cube>
I don't care
<companion_cube>
if you want to build a new ML from scratch and improve its design, go for it. There's 30 years of lessons learnt.
mro has joined #ocaml
<companion_cube>
but OCaml 5.0 should be about what we can do pragmatically, with OCaml, without breaking existing code, and ideally while providing sensible upgrade paths for everybody over the course of several years
<d_bot>
<monk> hey everyone. i've been working on my ocaml hackerrank solutions again and i'm hitting a resource/runtime limit. for some integers `a` and `b`, i'm need to get the inclusive range of `[a, b]` where `1 <= a <= b <= 10^9`.
<d_bot>
<monk>
<d_bot>
<monk> it's very clear that `List.range` doesn't deal with very large values of a and b. is there a simple optimization for this sort of problem? or is this where i should look to things like sequences?
<companion_cube>
are you going to iterate on each integer afterward?
<d_bot>
<monk> well, i guess to illuminate the full problem, all i want to do is check for squared values between `a` and `b`. i have that part right, it's just a matter of generating those values.
<d_bot>
<monk> so i think the answer to your question is yes?
<d_bot>
<octachron> If you only need to iterate once, you can use either a for-loop, or equivalently an iterator `(int -> unit) -> unit`.
<companion_cube>
if you mean `x*x`, then you probably want to iterate on [1, 10^(9/2)] instead
<companion_cube>
and square _that_
<d_bot>
<VPhantom> Ah, the first argument to `Printf.sprintf` is _not_ a string I can create from a few parts. 😕
<d_bot>
<monk> it's the other way, i want to know if for some value `x` within the range `[a, b]` whether `sqrt x - floor ( sqrt x)) = 0`
<d_bot>
<monk> though, i am guessing there is a way of generating the range of roots and using that as the solution too
<d_bot>
<octachron> It is indeed a format string and not a string, but you can concatenate format strings with `^^`.
<d_bot>
<RegularSpatula> VPhantom: i remember hitting that problem
<d_bot>
<monk> kind of like a sieve of erosthenes
<d_bot>
<monk> eratosthenes
<d_bot>
<octachron> (And there are more complicated tricks with formats and `%(...%)`)
<d_bot>
<VPhantom> Looking into `format_of_string` as a possible work-around.
<d_bot>
<octachron> @VPhantom , this is not the right direction, `format_of_string` is the identity.
<d_bot>
<VPhantom> Yeah it's not "of string" at all, it expects a format too! What a confusing name.
<d_bot>
<octachron> Yes, the name is meant `of_string(literal)`. Like I said earlier, you can either use `^^` (or `%(...%)`), or a `bprintf` to print into a buffer.
<d_bot>
<VPhantom> I don't understand that `%()` reference.
<d_bot>
<VPhantom> (More precisely: I don't see that in the man page.)
waleee has joined #ocaml
<d_bot>
<octachron> It is part of `Format` and not `Printf` (and it is one of the worst part of Format in term of complexity).
<d_bot>
<VPhantom> If technically I just want a variable containing the precision size, I bet there's a simpler way to achieve this. 🤔 I know there's something of a "reference" concept in there, but without examples I couldn't decipher it.
mro has quit [Ping timeout: 252 seconds]
<d_bot>
<VPhantom> Ah hes `*`
<d_bot>
<octachron> Much simpler: `Printf.printf "%.*g" 1 10.2`
<d_bot>
<VPhantom> I couldn't quite figure out what the docs mean by "specified as `*`"
<d_bot>
<VPhantom> Ah that's what they mean with "precedes"! Okay thank you!
<d_bot>
<VPhantom> (This is where my previous experiences with JS and Perl tended to have OCaml beat: they weren't shy with examples.)
<companion_cube>
@Vphantom just write a function for printing floats
<companion_cube>
and use %a along with it
<d_bot>
<VPhantom> Oh, interesting but `%.*f` here will work fine.
<d_bot>
<VPhantom> (Thanks for bringing `out_channel` to my attention. I haven't played with that yet and will explore.)
<pgiarrusso>
5:38 AM <ornxka> opam install coq-vst.2.9 <- i do this and then in ~/.opam i dont see any .vo files associated with coq-vst
mro has joined #ocaml
<pgiarrusso>
ornxka: any chance your default switch is another one? Else it's strange indeed (but #coq might be more helpful)
mro has quit [Read error: Connection reset by peer]
mro has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
<d_bot>
<VPhantom> Fun anecdote: does the X12 standard, which "recently" added UTF-8 support, mean _bytes_ or _characters_ now with its maximum field lengths? 😛 I bet it's still bytes for backwards compatibility. Who knows, though.
mro has quit [Remote host closed the connection]
jlrnick has joined #ocaml
andreypopp_ has joined #ocaml
<d_bot>
<VPhantom> Followup: anybody familiar with `Uutf`? It _seems_ to be what I need (already using it for something else), but I'm not sure. I have a string which may contain UTF-8. I want to enforce a maximum length _in bytes_, without breaking grapheme clusters so I can't just `String.sub`. I guess I'd need to remove entire grapheme clusters from the end until the new length satisfies the maximum. There's `Uutf.String` but I think that just
<d_bot>
<VPhantom> I want `Uuseg`, I think.
<companion_cube>
I think so too
<companion_cube>
uutf will not do grapheme clusters on its own
<d_bot>
<VPhantom> Funny how Uutf says that String and Buffer now have the ability to iterate over UTF-8 characters but I couldn't find that in the online docs. 🤔
<d_bot>
<VPhantom> (Ah, the online manual is still 4.13.)
<d_bot>
<VPhantom> Wow, seeing the 4.14 changelog I think I'll wait for that.
adanwan has quit [Remote host closed the connection]
<companion_cube>
or just use uutf
<companion_cube>
(or containers :p)
<d_bot>
<VPhantom> Uutf's API is um… I don't come from an intensely FP background and I have to invest a lot of time to try to understand his modules. I _think_ that the "folding" would be a way to iterate through a string with some callbacks, although that would still split graphemes (i.e. 🇨🇦 which is two UTF-8 characters). — Hm `CCUtf8_string.iter` could be a solution indeed. I could copy each character to a buffer and stop when the ne
<d_bot>
<VPhantom> Still the grapheme split issue though.
waleee has quit [Ping timeout: 256 seconds]
dextaa_ has joined #ocaml
<companion_cube>
probably can't avoid uuseg
v0idpwn has quit [Ping timeout: 268 seconds]
<d_bot>
<Anurag> do you want to iterate over graphemes? If so you will need uuseg
adanwan has joined #ocaml
<d_bot>
<VPhantom> I think so; ultimately I just want to trim strings which are too long without breaking anything, so I think that breaking a grapheme in two would be Bad™.
waleee has joined #ocaml
mro has joined #ocaml
v0idpwn has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]