<flux[m]>
I wonder though if it truly is unsafe. surely let a = "bar" and let b = "bar" cannot be so that both a and b mutate the same string?
<_xvilka_>
so I think worth adding an issue then for creating new type of the bytes constants then
<_xvilka_>
but github.com/ocaml/ocaml has issue tracker disabled
<flux[m]>
I think a syntax for byte literals would be the appropriate solution
<flux[m]>
s/byte/bytes/
<flux[m]>
Unless "foo" will be that syntax, in which case strings should maybe have one that truly copies the literal
<_xvilka_>
flux[m]: yes
<flux[m]>
I sort of can't imagine this discussion wouldn't have been had back when 'bytes' was introduced, though..
<flux[m]>
And if so, I wonder what were the results :)
<_xvilka_>
I am opening a bug, lets see what will happen
<flux[m]>
hmm
<flux[m]>
actually it's been a time back since I've written ocaml and I think I got confused
<_xvilka_>
decades of working on FOSS and with FOSS I learned one thing - "in case of doubt open a bug"
<flux[m]>
I think I mixed up bytes and strings regarding mutability :-).
<_xvilka_>
bytes are mutable, strings are not
<_xvilka_>
but in this case the problem is still the same
<flux[m]>
so setting myself on track, string is the immutable one, so obviously Bytes.unsafe_of_string "helo" is going to be unsafe, and there's no fast way to do it than Bytes.of_string "helo" and it cannot be optimized to be fast
<flux[m]>
consider let foo () = let bytes = Bytes.of_string "a" in Bytes.set bytes 0 (Char.chr (Char.code (Bytes.get bytes 0) + 1)); Bytes.get bytes 0
<flux[m]>
there's no way to avoid copying the string "a" for constructing the bytes
<flux[m]>
(btw, not a beatiful sight that incrementing..)
<_xvilka_>
by the way, totally unrelated. Working on distributed application on zeromq bus. Every request/answer has some ID (request/answer in semantic meaning, they can exist on top of many different zeromq messages, like fragmented). Currently (at the early prototype stage) I just generate those IDs randomly. But there is still a chance of collision. What is the best solution to solve the uniqueness problem in
<_xvilka_>
case of the big cluster of distributed workers?
orbifx has joined #ocaml
<zozozo>
_xvilka_: hash the contents of the message ?
<_xvilka_>
zozozo: hmm, you mean of the first message in the whole chain of request/answer? yeah, sounds like a good idea
<zozozo>
or alternatively, hash the MAC or other unique hardware id + an increasing integer for each message
<_xvilka_>
zozozo: no, hardware id is no go - there can be a cases of multiple workers at the same machine if the machine is powerful enough
<zozozo>
hardware id + process id + unique increasgin integer ? though it becomes quite complex, :p
groovy2shoes has joined #ocaml
tarptaeya has quit [Quit: Konversation terminated!]
<_xvilka_>
zozozo: I think your idea of hashing the message is good enough for my usecase
<zozozo>
^^
mfp_ has joined #ocaml
argent_smith has joined #ocaml
ChristopheT has joined #ocaml
orbifx has quit [Ping timeout: 255 seconds]
orbifx has joined #ocaml
zolk3ri has joined #ocaml
jnavila has joined #ocaml
Haudegen has joined #ocaml
weird_error has joined #ocaml
jnavila has quit [Ping timeout: 240 seconds]
jnavila has joined #ocaml
silver has joined #ocaml
mk9 has joined #ocaml
mk9 has quit [Ping timeout: 256 seconds]
jnavila has quit [Ping timeout: 255 seconds]
malina has joined #ocaml
malina has quit [Quit: Throwing apples of Montserrat]
malina has joined #ocaml
bartholin has quit [Quit: Leaving]
mk9 has joined #ocaml
dhil has joined #ocaml
jnavila has joined #ocaml
malina has quit [Ping timeout: 276 seconds]
pierpal has quit [Read error: Connection reset by peer]
mk9 has quit [Quit: mk9]
<_xvilka_>
I have a webserver which translates JSON web requests into the ZeroMQ. So it has two main threads - one is for the Opium and another for handling messaging. I am using Lwt. Is it possible to create a waiter thread in one function called from the web-server (Opium) thread and then wait for the message in the message-handling thread
<_xvilka_>
it is not compilable yet, but you can get the idea
pierpal has joined #ocaml
<discord1>
<rizo> I usually use Lwt_stream for that. It gives you exactly what you described, I think. I remember seeing mentioned that Lwt_stream has some design issues and might be changed/replaced in the future, though.
webchat192 has joined #ocaml
<discord1>
<rizo> You can also take a look at the lwt-pipe package.
jimmyrcom_ has joined #ocaml
webchat192 has quit [Ping timeout: 260 seconds]
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #ocaml
jimmyrcom_ has quit [Ping timeout: 240 seconds]
malina has joined #ocaml
<_xvilka_>
@rizo: aha, thx
pierpal has quit [Read error: Connection reset by peer]
orbifx has quit [Ping timeout: 260 seconds]
mk9 has joined #ocaml
tarptaeya has joined #ocaml
exarkun has quit [Ping timeout: 248 seconds]
dhil has quit [Ping timeout: 248 seconds]
pierpal has joined #ocaml
pierpal has quit [Read error: Connection reset by peer]
exarkun has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
<seliopou>
hannes that patch for bigstringaf looks like it should work?
pierpal has joined #ocaml
nullifidian has quit [Remote host closed the connection]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
jnavila has quit [Ping timeout: 240 seconds]
pierpal has quit [Ping timeout: 240 seconds]
sh0t has joined #ocaml
jimmyrcom_ has joined #ocaml
elfring has joined #ocaml
cslqj has joined #ocaml
olopierpa[m] has quit [Ping timeout: 256 seconds]
hcarty[m] has quit [Ping timeout: 256 seconds]
olopierpa[m] has joined #ocaml
hcarty[m] has joined #ocaml
spectrumgomas[m] has quit [Ping timeout: 256 seconds]
mrallen1 has quit [Ping timeout: 256 seconds]
mrallen1 has joined #ocaml
pierpal has joined #ocaml
spectrumgomas[m] has joined #ocaml
ctrlsbstr has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
nullifidian has joined #ocaml
Haudegen has joined #ocaml
pierpal has quit [Ping timeout: 268 seconds]
pierpal has joined #ocaml
BitPuffin has joined #ocaml
pierpal has quit [Read error: Connection reset by peer]
jbrown has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
sh0t has quit [Ping timeout: 248 seconds]
pierpal has joined #ocaml
ianconnolly_ has quit [Remote host closed the connection]
terrorjack has quit [Remote host closed the connection]
ianconnolly_ has joined #ocaml
picolino has quit [Ping timeout: 240 seconds]
orbifx has joined #ocaml
terrorjack has joined #ocaml
picolino has joined #ocaml
mk9 has quit [Quit: mk9]
Haudegen has quit [Ping timeout: 240 seconds]
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #ocaml
Haudegen has joined #ocaml
ctrlsbstr has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bartholin has joined #ocaml
kleimkuhler has joined #ocaml
ctrlsbstr has joined #ocaml
kleimkuhler_ has joined #ocaml
kleimkuhler has quit [Ping timeout: 240 seconds]
cslqj has quit [Remote host closed the connection]
cslqj has joined #ocaml
Haudegen has quit [Ping timeout: 256 seconds]
kleimkuhler_ has quit [Quit: kleimkuhler_]
jnavila has joined #ocaml
kleimkuhler has joined #ocaml
orbifx has quit [Quit: WeeChat 2.0.1]
cslqj has quit [Remote host closed the connection]
cslqj has joined #ocaml
cslqj has quit [Remote host closed the connection]
cslqj has joined #ocaml
cslqj has quit [Remote host closed the connection]
cslqj has joined #ocaml
cslqj has quit [Remote host closed the connection]
cslqj has joined #ocaml
cslqj has quit [Ping timeout: 240 seconds]
ziyourenxiang has quit [Ping timeout: 276 seconds]
muelleme has joined #ocaml
sh0t has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
Haudegen has joined #ocaml
kakadu has left #ocaml ["Konversation terminated!"]
weird_error has quit [Quit: weird_error]
hratt has joined #ocaml
weird_error has joined #ocaml
<hratt>
hey can someone here help explain the syntax of the `parser' function?
spew has joined #ocaml
<hratt>
im trying to debug a file for a keyMerging utility but know 0 ocaml
Haudegen has quit [Ping timeout: 256 seconds]
<spew>
hratt: now is your opportunity to learn
weird_error has quit [Quit: weird_error]
<hratt>
im trying i cant find the syntax explained somewhere and its just this file out of around a hundred
ctrlsbstr has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<thizanne>
hratt: that's quite old
<hratt>
ye the thing is using camlp4 natively but i switched it out for cppo as i know no other ways
<hratt>
by the way the syntax error was using ` | [< ` after the parser function call removed the bar alls fine - thank you very much @thizanne helped a lot
<thizanne>
that's not a function, that's a keyword
<thizanne>
camlp4 provides a syntax extension to ocaml that adds this keyword and the odd matching stuff
loli has quit [Quit: WeeChat 2.1]
<octachron>
hratt, you cannot replace camlp4 by cppo except for some very basic use cases of camlp4, and parser is not amongst those use cases
<hratt>
ive switched back but i realise now
<hratt>
i think it was like perl where most cpan modules had 60000000 others cx
gpietro has quit [Remote host closed the connection]
gpietro has joined #ocaml
zolk3ri has quit [Remote host closed the connection]
loli has joined #ocaml
kakadu has joined #ocaml
<pmetzger>
If you don't know a language, it's probably not a good idea to start randomly replacing things with other things.
gpietro has quit [Ping timeout: 256 seconds]
pierpal has quit [Ping timeout: 256 seconds]
pierpal has joined #ocaml
pierpal has quit [Client Quit]
pierpal has joined #ocaml
Haudegen has joined #ocaml
exarkun has quit [Read error: Connection reset by peer]
pierpal has quit [Remote host closed the connection]
exarkun has joined #ocaml
jbrown has quit [Quit: Leaving]
kleimkuhler has quit [Quit: kleimkuhler]
kleimkuhler has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
pierpal has joined #ocaml
ctrlsbstr has joined #ocaml
Haudegen has joined #ocaml
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #ocaml
hratt has quit [Quit: leaving]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
muelleme has joined #ocaml
pierpal has quit [Read error: Connection reset by peer]
malina has quit [Read error: Connection reset by peer]
BitPuffin has quit [Remote host closed the connection]
muelleme has quit [Ping timeout: 256 seconds]
pierpal has joined #ocaml
elfring has quit [Quit: Konversation terminated!]
spew has joined #ocaml
tane has joined #ocaml
tane has quit [Quit: Leaving]
ctrlsbstr has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jnavila has quit [Read error: Connection reset by peer]
sz0 has quit [Quit: Connection closed for inactivity]
malina has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
spew has quit [Ping timeout: 256 seconds]
argent_smith has quit [Quit: Leaving.]
gtrak has joined #ocaml
kakadu has quit [Remote host closed the connection]
gtrak has quit [Ping timeout: 264 seconds]
ziyourenxiang has joined #ocaml
gtrak has joined #ocaml
FreeBirdLjj has joined #ocaml
gtrak has quit [Ping timeout: 264 seconds]
shinnya has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 256 seconds]
Bronsa` has joined #ocaml
malina has quit [Quit: Throwing apples of Montserrat]