<demurgos>
Hi, I am encountering a really strange behavior with OCaml. I create two identical strings: one as a literal (`"\xaa\xaa"`), the second one with `Bytes.to_string (Bytes.make 2 '\xaa')`. String.compare returns 0, they are identical.
<demurgos>
Now, what happens is that if I use the literal string, my function throws an error but when I use the string built with Bytes it works.
<Drup>
Can you pastebin the code somewhere ?
<demurgos>
Even worse: if I simply define my string with a literal but never use it (flagged by the compiler), it still breaks the function
<demurgos>
More precisely, the issue is only around: main.ml, line 55 ; IO.nwrite, IO.close and Extc.output_zip
<demurgos>
I will try to isolate it even more, but I just feel that I encountered a really weird memory error
<Drup>
pure ocaml should never get something like that, so it's probably zlib's fault (or a bug in the compiler, but unless you are on trunk, this is extremly unlikely)
<demurgos>
I know, those are both the stable version of zlib and the stable version of haxe
<Drup>
You should try to extract the zlib part and see if you can reproduce with just that
virtualeyes has quit [Ping timeout: 260 seconds]
<demurgos>
I know that I did not finish isolating the issue, but I hit a wall here because if I move this code and literal directly in Extc to directly call zlib, it works perfectly (no error).
<demurgos>
I'll try to move it outside of the context of the compiler at least
groovy2shoes has quit [Quit: Leaving]
wtetzner has quit [Remote host closed the connection]
mengu has quit [Remote host closed the connection]
jao has quit [Remote host closed the connection]
jao has joined #ocaml
Onemorenickname has quit [Read error: Connection reset by peer]
virtualeyes has joined #ocaml
demurgos has quit [Quit: Page closed]
Marak has joined #ocaml
<Marak>
Hello. I'm working a little web service for executing ocaml code. I've got it mostly working, but need to figure out how to eval an string as ocaml code. I found http://stackoverflow.com/questions/33291754/eval-a-string-in-ocaml, but I'm hoping to do it with just using ocaml binary itself. Is this possible?
<Marak>
perhaps by using compiler-libs package?
<Drup>
Marak: what's your issue with the first answer ?
<Marak>
Drup: It's talking about running UTop? I just have ocaml right now.
silver has quit [Quit: rakede]
<Marak>
It's actually my first day ever using ocaml, so I'm an epic noob right now. My apologies.
<Drup>
the first answer doesn't talk about utop,
<Drup>
or rather, it doesn't actually need it, not sure why this comment was added
<Marak>
`Error: Unbound module Toploop`
<Drup>
yeah, you need to load compiler-libs
<Marak>
how would i do that?
<Marak>
is it a package i require, or a flag for building?
<Marak>
Mostly as a fun and easy way to write streaming webservices in ocaml. Probably wouldn't be super performant ( to start ). We are adding plans for a compilation step in the future. I'm just experimenting now using -stdin flag
<Drup>
Ehe, surprisingly, all the supported languages are interpreted :D
<Drup>
anyway, in this case, just pipe to toplevel, yeah
<Marak>
i'm still getting Unknown directive `require'. and i'm fairly certain i configured opam correctly and setup the env variables it wants
<Marak>
i did install from brew, that might have to do with it
<Drup>
what's the content of .ocamlinit ?
<Drup>
(in your ~ )
<Marak>
(* Added by OPAM. *) let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> () ;;
<Drup>
Add "#use "topfind";;" on it's own line, at the end
<Drup>
(without the surrounding quotes)
<Marak>
i did that and opened up a new shell, same
<Marak>
#use "topfind";;
<Marak>
wait, one sec
<Marak>
nope, no luck
<Drup>
huuum, "opam install ocamlfind" ?
<Marak>
[NOTE] Package ocamlfind is already installed (current version is 1.7.1).
<Drup>
right, as expected
<Drup>
you tried utop ?
<Marak>
i'm getting sub 20ms response time on ocaml binary. would utop be a replacement for ocaml binary?
<Marak>
overhead of spawning process is a concern
fraggle_ has joined #ocaml
<Drup>
yeah, let's try to make it work first, right ?
<Marak>
okay, i'll try out utop, it seems like a nice tool to have anyway. brb
<Drup>
if your only concern is to eval ocaml code by spawning a process each time, you don't even need to write ocaml code anyway
<Drup>
just pipe to the ocaml toplevel
<Marak>
aye, but i'll need to do a codegen to create a bit of ocaml to create environment for microservice
<Marak>
we've got two hashes, of http params, and env variables
<Drup>
well, you can still use pipes :D
<Marak>
yes, i've got that part working
<Marak>
utop seems to have no issues running the script, heh. also it seems awesome
Flerex has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<Marak>
going to circle around again and see when i get stuck. i'll try not to bug you
<Marak>
thanks Drup
<Marak>
wow
<Marak>
its working
<Marak>
node.js http streams connected to stdin / stdout of ocaml. neat
fraggle_ has quit [Ping timeout: 255 seconds]
<Marak>
i should push this further. whats the recommended way to make http requests in ocaml?
<Drup>
the cohttp library
<Marak>
installing now
<Marak>
i'm curious. opam is installing these dependencies per user? not per application? what happens if i needed to use two separate versions of a package at once in two separate applications on the same system.
<Drup>
There is a thing called switches, which allows parallel installations
<Marak>
cool
fraggle_ has joined #ocaml
<Marak>
hrmmm. Error: Unbound module Lwt
<Marak>
$ opam install Lwt [NOTE] Package lwt is already installed (current version is 2.7.0).
<Marak>
probably not, i just ran the example without really reading it.
<Marak>
im still trying to figure out this syntax.
<Marak>
i think i understand it now, trying
<Drup>
in the toplevel, you need to #require packages. If you compile (with ocamlbuild for example) you need to provide them on the command line (with -pkg, in the case of ocamlbuild)
<Marak>
thanks
<Marak>
i got lwt and cohttp #required, but its getting hung up Error: Reference to undefined global `Cohttp_lwt_unix'
<Marak>
No such package: cohttp_lwt_unix
<Drup>
(run "ocamlfind list" to get the list of packages, it unfortunatly doesn't always map 1-1 to module names)
<Marak>
#require "cohttp.lwt", much success
<Marak>
so cool, thanks again Drup. you've probably saved me hours of time
<Marak>
how is JSON support in Ocaml? good, or bad? i have to choose between using Ocaml the parse the incoming argv JSON into ocaml data structures, or use the eval function to evaluate a block of meta-programmed ocaml code ( that came over argv from javascript land )
<Marak>
programming is fun
<Marak>
yojson, looks good
virtualeyes has joined #ocaml
FreeBirdLjj has joined #ocaml
ivan_ has quit [Remote host closed the connection]
mesiviah_ has quit [Remote host closed the connection]
govg has quit [Quit: leaving]
fedruantine has quit [Ping timeout: 248 seconds]
obadz has quit [Ping timeout: 260 seconds]
obadz has joined #ocaml
mfp has quit [Ping timeout: 256 seconds]
fedruantine has joined #ocaml
jao has quit [Ping timeout: 240 seconds]
Marak has quit [Ping timeout: 260 seconds]
snhmib has quit [Ping timeout: 240 seconds]
agarwal1975 has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
snhmib has joined #ocaml
agarwal1975 has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
virtualeyes has quit [Read error: Connection reset by peer]
virtualeyes1 has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
fedruantine has quit [Ping timeout: 258 seconds]
mattrepl has quit [Quit: mattrepl]
FreeBirdLjj has joined #ocaml
fedruantine has joined #ocaml
agarwal1975 has joined #ocaml
pyx has joined #ocaml
pyx has quit [Client Quit]
fedruantine has quit [Ping timeout: 252 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
agarwal1975 has quit [Quit: agarwal1975]
snhmib has quit [Ping timeout: 256 seconds]
virtualeyes1 has quit [Ping timeout: 276 seconds]
groovy2shoes has joined #ocaml
snhmib has joined #ocaml
pierpa has quit [Ping timeout: 240 seconds]
agarwal1975 has joined #ocaml
FreeBirdLjj has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
larhat has joined #ocaml
larhat has quit [Client Quit]
defgeneric has quit [Ping timeout: 240 seconds]
MercurialAlchemi has joined #ocaml
djellemah has quit [Ping timeout: 240 seconds]
Flerex has joined #ocaml
<shon>
Oh man... the build stuff is really driving me nuts. I'm starting to think I'm just not smart enought to handle these build tools. Nothing works like I expect it to.
<shon>
That's just steam blowing off, btw -- not a cry for help.
<Marak>
need to write examples and documentations and will have it included in the next update to https://hook.io
Flerex has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
william-s has joined #ocaml
AlexDenisov has joined #ocaml
snhmib has quit [Ping timeout: 240 seconds]
MercurialAlchemi has quit [Ping timeout: 245 seconds]
<shon>
I failed to realize that specifying a module signature in an mli file without actually duplicating the contents of the signature there has the effect of creating an abstract module type, leaving all the internals inaccessible! Now I know, and it makes sense...
<shon>
But that was a rough wall to bang my head on for 3 hours...
snhmib has joined #ocaml
<shon>
I wonder if anyone here has had good experiences with solvuu-build (https://github.com/solvuu/solvuu-build). It seems like using the language itself to specify the build is an appealing idea, and taking care of the .merlin and .ocamlinit files automatically is a sweet bonus...
Marak has quit [Ping timeout: 260 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
govg has joined #ocaml
rgrinberg has quit [Ping timeout: 255 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
djellemah has joined #ocaml
FreeBirdLjj has joined #ocaml
MercurialAlchemi has joined #ocaml
Algebr has joined #ocaml
govg has quit [Ping timeout: 240 seconds]
govg has joined #ocaml
zpe has joined #ocaml
<Algebr>
Is there anywhere in the manual that formally talks about hex string literals? the "\x00\x12", etc
<Algebr>
And what is the easiest way to turn a byte sequence into an integer without a library
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ewanas has quit [Remote host closed the connection]
zpe has quit [Remote host closed the connection]
ewanas has joined #ocaml
govg has quit [Quit: leaving]
snhmib has quit [Ping timeout: 264 seconds]
Simn has joined #ocaml
fre has joined #ocaml
snhmib has joined #ocaml
govg has joined #ocaml
Algebr has quit [Ping timeout: 255 seconds]
govg has quit [Client Quit]
<companion_cube>
int_of_string?
<companion_cube>
or are you talking about turnning 4 bytes into an int? (in which case you'd better use a lib imho, to explicitely specify endianess)
ocalm has quit [Quit: Leaving]
jnavila has joined #ocaml
william-s has quit [Quit: WeeChat 1.7]
ocalm has joined #ocaml
<ocalm>
Hi
<ocalm>
what editor do you use for ocaml?
AlexDenisov has joined #ocaml
<ocalm>
I use VS Code at the moment.
AlexDenisov has quit [Client Quit]
<flux>
emacs! is vs code good for it? does it work with merlin?
<flux>
apparently there's some support available from the visualstudio marketplace
alfredo has joined #ocaml
AlexDenisov has joined #ocaml
<ocalm>
Yes it does has support, from the little I know. github.com/hackwaly/vscode-ocaml
AltGr has joined #ocaml
zpe has joined #ocaml
kakadu has joined #ocaml
cheater has quit [Ping timeout: 240 seconds]
cheater has joined #ocaml
<companion_cube>
flux: yes, it does show types on hover, and all that
zv has quit [Quit: WeeChat 1.6]
govg has joined #ocaml
jnavila has quit [Quit: It was time]
jnavila has joined #ocaml
larhat has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has joined #ocaml
<flux>
well, that's the main feature :), but the rest would be nice as well
<companion_cube>
cause the behavior of crashing if you just *declare* a constant string is definitely not normal
<demurgos2>
Yes, but I do not know if it is a problem with the OCaml compiler, zlib or Haxe
<demurgos2>
I opened the issue on the Haxe repo since it where I discovered it, but it is really not clear
<demurgos2>
Now, I managed to isolate it from the compiler, so it is either ocamlc or zlib
<demurgos2>
(the compiler = haxe)
fre has joined #ocaml
dhil has joined #ocaml
dhil has quit [Client Quit]
dhil has joined #ocaml
snowcrshd has joined #ocaml
govg has quit [Quit: leaving]
govg has joined #ocaml
govg has quit [Client Quit]
govg has joined #ocaml
dhil has quit [Ping timeout: 260 seconds]
<orbifx-m>
does cstruct support variant fields?
<orbifx-m>
Also, what's the best way to express a fold over a Buffer?
<orbifx-m>
convert it to string than to array? or something else?
<companion_cube>
erf
<companion_cube>
this is quite sad, Buffer doesn't even have `iter` :/
zpe has quit [Ping timeout: 240 seconds]
mengu has joined #ocaml
silver has joined #ocaml
<orbifx-m>
Let's check batteries
<zozozo>
seemes like a good idea for a PR
<companion_cube>
zozozo: please do it then
<companion_cube>
I provide a `to_seq` function in my iterator PR though
dhil has joined #ocaml
<zozozo>
well, that would be better
_andre has joined #ocaml
<zozozo>
I'll look at it and try the PR soon (assuming nothing moves on iterators)
<orbifx-m>
Do you have to open an issue or anything?
FreeBirdLjj has joined #ocaml
<zozozo>
there are no issues on the ocaml github sadly, so you could open one on mantis but I think a PR is actually better
<orbifx-m>
you mean impement it and request a merge (PR = pull request?)
<companion_cube>
yes
<companion_cube>
anyway, I'd also like to make a PR for more list functions
<orbifx-m>
And do I'm I correct that they now accept merge requests from github?
<companion_cube>
indeed they do
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has joined #ocaml
govg has quit [Ping timeout: 256 seconds]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snhmib has quit [Read error: Connection reset by peer]
larhat has quit [Quit: Leaving.]
freehck has joined #ocaml
fre has quit [Ping timeout: 276 seconds]
silver_ has joined #ocaml
silver has quit [Ping timeout: 260 seconds]
demurgos2 has quit [Quit: Page closed]
demurgos has quit [Quit: Page closed]
jao has joined #ocaml
silver_ is now known as silver
ocaml101 has joined #ocaml
larhat has joined #ocaml
snhmib has joined #ocaml
jao has quit [Ping timeout: 255 seconds]
mengu has quit [Remote host closed the connection]
AlexDenisov has joined #ocaml
snhmib has quit [Ping timeout: 258 seconds]
fre has joined #ocaml
Algebr has joined #ocaml
ansiwen_ is now known as ansiwen
Algebr has quit [Ping timeout: 255 seconds]
ocp has quit [Quit: Leaving.]
snhmib has joined #ocaml
__y has quit [Ping timeout: 252 seconds]
tobiasBora has quit [Ping timeout: 256 seconds]
zpe has joined #ocaml
xorpse has joined #ocaml
yomimono has joined #ocaml
_y has joined #ocaml
tobiasBora has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
snhmib has quit [Ping timeout: 252 seconds]
AltGr has left #ocaml [#ocaml]
mattrepl has joined #ocaml
mengu has joined #ocaml
govg has joined #ocaml
nomicflux has joined #ocaml
wtetzner has joined #ocaml
yomimono has quit [Ping timeout: 240 seconds]
snhmib has joined #ocaml
wtetzner has quit [Ping timeout: 248 seconds]
virtualeyes has joined #ocaml
nomicflux has quit [Quit: nomicflux]
yomimono has joined #ocaml
sh0t has joined #ocaml
AltGr has joined #ocaml
dhil has quit [Ping timeout: 240 seconds]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dhil has joined #ocaml
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
Flerex has joined #ocaml
AlexDenisov has joined #ocaml
virtualeyes has quit [Ping timeout: 240 seconds]
ocaml101 has quit [Ping timeout: 260 seconds]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
infinity0_ has joined #ocaml
infinity0_ has joined #ocaml
infinity0 has quit [Changing host]
infinity0 has quit [Remote host closed the connection]
govg has quit [Ping timeout: 240 seconds]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
govg has joined #ocaml
infinity0 has joined #ocaml
jfntn has joined #ocaml
infinity0 has quit [Remote host closed the connection]
virtualeyes has joined #ocaml
infinity0 has joined #ocaml
govg has quit [Ping timeout: 240 seconds]
infinity0 has quit [Remote host closed the connection]
MercurialAlchemi has quit [Ping timeout: 256 seconds]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
jfntn has quit [Remote host closed the connection]
jfntn has joined #ocaml
infinity0 has joined #ocaml
rgrinberg has joined #ocaml
rossberg has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Remote host closed the connection]
sz0 has joined #ocaml
rgrinberg has joined #ocaml
ciniglio has joined #ocaml
rossberg has joined #ocaml
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has joined #ocaml
<cheater>
hey guys
<cheater>
i've noticed when i get type errors the location of the error starts on the space before the value, rather on the value itself. it seems like a bug. can someone confirm this is or isn't the behaviour we want?
<Drup>
the indexes in error message follow the usual conventions for error message such that they are properly highlited by emacs/vim/others
<Drup>
Not sure what you are using, but as first guess: you are counting columns off by one
<cheater>
i'm using vim
<cheater>
and if i have code like
<cheater>
my_func my_val
<cheater>
and my_val is of the wrong type
<cheater>
then this is where the error will start:
<cheater>
my_funcXmy_val
virtualeyes has quit [Ping timeout: 260 seconds]
larhat has quit [Quit: Leaving.]
virtualeyes has joined #ocaml
shinnya has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
<flux>
cheater, have you looked what the output of the compiler is?
MercurialAlchemi has joined #ocaml
<flux>
cheater, also are there tabs involved?
shinnya has quit [Ping timeout: 240 seconds]
xorpse has quit [Ping timeout: 252 seconds]
govg has joined #ocaml
<jerith>
flux: You were interested in slacko stuff, right?
handlex has quit [Read error: Connection reset by peer]
handlex has joined #ocaml
zpe has quit [Remote host closed the connection]
handlex has quit [Ping timeout: 276 seconds]
<Leonidas>
jerith: yes, thanks. Will look into it!
<jerith>
Leonidas: Cool, whenever you have time.
<jerith>
It was an interesting weekend project and I discovered that my conduit bug from a year ago (which is relevant to the test code) was fixed in December. :-)
<Leonidas>
jerith: I'm kinda thinking whether it wouldn't be better to functorize instead of the set_base_url so the tests could create their own environment without any mutation under the hood.
<cheater>
flux, no tabs
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jerith>
Leonidas: My main goal here was to make the minimum feasible change to the non-test code.
<cheater>
flux, i haven't seen the output of the compiler, why is that relevant?
<jerith>
I'm definitely happy to change non-test code, and the functor thing sounds like a reasonable approach, but I wanted to have this kind of conversation before hacking your library to bits and reassembling it in a different order.
<Leonidas>
jerith: yep, I see your reasoning :-)
<Leonidas>
I'm thinking whether it would make sense to functirize even further so Lwt.t could be replaced by e.g. something lighter that would be easier to test.
<Leonidas>
so happy we're at 0.x so we can break whatever we please :D
slash^ has joined #ocaml
<jerith>
Anyway, I have to head out for the evening. I'll probably be on IRC sporadically during band practice, but not really in a way that would allow proper conversation.
<Leonidas>
no worries :)
fre has quit [Ping timeout: 240 seconds]
<Leonidas>
jerith: anyway, I am quite surprised coverall works. That's *really* neat :)
jnavila has quit [Quit: It was time]
AlexDenisov has joined #ocaml
<jeroud>
I spent way too long looking for a way to use codecov.io instead, but that would be a lot more work.
<jeroud>
Branch coverage, a nicer UI, and useful PR comments.
virtualeyes1 has joined #ocaml
virtualeyes has quit [Ping timeout: 255 seconds]
alfredo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mengu_ has joined #ocaml
Flerex has quit [Read error: Connection reset by peer]
<cheater>
Leonidas companion_cube do you guys see the same issue with type errors?
<cheater>
i.e. the error location starts on the space before whatever is causing the error rather than on the first letter of the identifier/expression/whatever
mengu has quit [Ping timeout: 258 seconds]
ygrek_ has joined #ocaml
<companion_cube>
I don't know, for me vim knows where to jump
<companion_cube>
because lines and columns start at 1, no 0
slash^ has quit [Read error: Connection reset by peer]
jao has joined #ocaml
<cheater>
"riddle.ml"
<cheater>
that sounds like something i shouldn't read
Muzer has joined #ocaml
alfredo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<octachron>
cheater, this is more or less a (atrocious) worse case scenario for dependencies computation in OCaml, no something that anyone would write (or read) in normal code
<octachron>
((at least I hope so))
virtualeyes1 has quit [Ping timeout: 240 seconds]
* Drup
raises his hand
virtualeyes has joined #ocaml
<Drup>
(it was not in "real" software, though)
jnavila has joined #ocaml
<companion_cube>
GADTs + first class modules? Oh, I must have both not too far away from one another
<Drup>
the thing is, most of the use cases are better solved by (*gasp*) objects
<companion_cube>
boarf
<octachron>
companion_cube, + opening/including first-class modules without signature annotation, because … reasons?
<companion_cube>
ah, that
<companion_cube>
not often indeed
<companion_cube>
I tend to annotate mos tof my code anyway
kakadu has joined #ocaml
<cheater>
octachron: :)
<cheater>
octachron: hey have you noticed that the type errors emitted by the compiler start at the wrong column?
<cheater>
octachron: so for me, when i get a type error in something like "foo bar" and bar is the wrong type, then the columns mentioned in the type error start at the space before "bar" which seems bizarre
emacs-fb has joined #ocaml
<cheater>
octachron: i wonder if that's by design or just an off by one error?
fre has joined #ocaml
<emacs-fb>
I came across a situation where a simple OCaml program compiled with ocamlopt works differently than that same program interpreted -- print_string does not print unless manually flushed from OCaml in the compiled version, but prints just fine in the interpreted version.
<emacs-fb>
See ./print_endline.out vs ./print_string.out
AlexDeni_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<emacs-fb>
Is this expected? Is there an OCaml buffer I have to flush automatically?
AlexDenisov has joined #ocaml
Xadnem has quit [Quit: leaving]
fre has joined #ocaml
AlexDenisov has quit [Client Quit]
nomicflux has quit [Quit: nomicflux]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
orbifx has joined #ocaml
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
<octachron>
cheater, isn't that simply ocaml column count starting at 0 after a new line?
snowcrshd has quit [Read error: Connection reset by peer]
_andre has quit [Quit: leaving]
hcarty has joined #ocaml
<cheater>
octachron: hmm
<cheater>
octachron: why would it start at 0 though?
<octachron>
emacs-fb, input/outputs through Pervasives.*channel are indeed buffered and you may need to flush with "Pervasives.flush output_channel"
<octachron>
cheater, because 0 is the first ordinal?
<cheater>
nope octachron it doesn't start at 0
<cheater>
because the right end of the range is where it should be
<cheater>
so if my line is
<cheater>
foo bar
<cheater>
and bar is wrong
<cheater>
it'll say columns 4-7
<emacs-fb>
octachron: I don't need to do that when running with `ocaml print_string.ml` or even `ocamlopt print_string.ml; ./a.out` -- why is this?
<cheater>
so starting with the space and ending with r
orbifx has quit [Ping timeout: 240 seconds]
mengu_ has quit [Remote host closed the connection]
<lyxia>
If you assume it starts at 0, then it's the end of the range which is one column past the actual end of the range, while the start is at the right place.
<octachron>
not if the range is right exclusive: [4,7)
<lyxia>
that too
<cheater>
octachron: ....... :)
<lyxia>
isn't it a pretty common convention in fact?
<cheater>
well, it seems to be doing what octachron said
<cheater>
so for example this...
<cheater>
Arg.parse 2 (fun str -> ()) "UsageMsg"
<cheater>
says the error is:
<cheater>
File "my_prog.ml", line 5, characters 12-13:
<cheater>
"2" is just one character
<cheater>
but..
<cheater>
1. it's confusing 2. you never start counting columns with 0 in text editing
<Drup>
cheater: just in case this wasn't clear: your setup/editor is wrong, ocaml isn't.
<cheater>
how is vim wrong in counting columns
<Drup>
ocaml follow the same convention than C compilers and error messages works perfectly fine under emacs and various other editors, draw the conclusion you want from that. :)
AltGr has left #ocaml [#ocaml]
<cheater>
do c compilers use the same convention?
<cheater>
i didn't know that
fre has quit [Read error: No route to host]
<cheater>
also i noticed that emacs starts counting at 0 too
<cheater>
nano starts at 1
<cheater>
other stuff... is of less significance
<cheater>
OK now i understand why ocaml reports errors like this :)
<cheater>
thanks :)
<Drup>
your ocaml mode for vim should handle that stuff correctly, anyway
<cheater>
i don't use an ocaml mode
<cheater>
i just type make in bash
<cheater>
and go to the line and column by hand
<cheater>
works well enough for me
<Drup>
You like loosing time in counting columns ? ^^'
fre has joined #ocaml
<companion_cube>
:/
fre has quit [Read error: Connection reset by peer]
<companion_cube>
cheater: you didn't even install merlin?
leah2 has quit [Ping timeout: 255 seconds]
<octachron>
emacs-fb, both works for me (since the implicit exit is flushing still-open channel )
<octachron>
emacs-fb, print_string (print_endline always flush) on linux
<octachron>
with either ocamlc or ocaml
<emacs-fb>
octachron: Using the GitHub Gist or via one of: `ocaml print_string.ml`, `ocamlopt print_string.ml; ./a.out`? The latter two work for me and the Gist does not. I am running OS X.
virtualeyes1 has joined #ocaml
virtualeyes has quit [Ping timeout: 240 seconds]
fre has joined #ocaml
<emacs-fb>
The Gist being compiling to an object file then running from a C program.
<emacs-fb>
afk for lunch
virtualeyes1 is now known as nullremains
fre has quit [Read error: No route to host]
tg has quit [Excess Flood]
tg has joined #ocaml
emacs-fb has quit [Ping timeout: 240 seconds]
jfntn has quit [Remote host closed the connection]
dhil has quit [Ping timeout: 240 seconds]
MercurialAlchemi has quit [Ping timeout: 255 seconds]
leah2 has joined #ocaml
emacs-fb has joined #ocaml
APNG is now known as CTCP-S
orbifx-m has quit [Ping timeout: 240 seconds]
orbifx has joined #ocaml
<octachron>
emacs-fb, just to be sure, you obtain different results with your C file when linking with the bytecode or native runtime?
<emacs-fb>
octachron: I obtain different results between: A) compiling to a .o then linking with the aforementioned C file B) ocamlopt print_string.ml; ./a.out