<companion_cube>
yeah, it's a bit experimental, I don't want to make bot-haters angry :p
<rightfold>
Can I have a module in m.ml and then another one in m/n.ml and then open m/n.ml in m.ml? I'm getting a circular build error when I do this even if m/n.ml doesn't use anything from m.ml
<companion_cube>
m/ is of no impact on the build system, usually
<mrvn>
what if you have just m.ml and n.ml?
_andre has joined #ocaml
<rightfold>
if I rename m/n.ml to n.ml and delete m/ then it compiles
<rightfold>
Circular build detected (src/m.cmx already seen in [ src/m.cmx ])
<companion_cube>
does m.ml use `M` in the code?
<rightfold>
no, only N
<octachron>
rightfold: are you by any chance opening "M.N" and not "N"?
<rightfold>
yes
<rightfold>
if I reference N then it says no module implementations were provided for N
<octachron>
you need to include the directory m
<reynir>
Argh, ~/.opam/4.02.3/lib/ocp-index/META was missing a closing double quote
<reynir>
I wonder how that happened
Algebr` has quit [Read error: Connection reset by peer]
Algebr` has joined #ocaml
Algebr` has quit [Read error: Connection reset by peer]
Algebr` has joined #ocaml
<rightfold>
whatever, I'll just not use directories
<mrvn>
rightfold: the ugly workaround there is to use m/m_N.ml, include m/ in the search path and in M then alias M_N
<CuriousErnestBro>
hello
AlexRussia_ has quit [Ping timeout: 260 seconds]
<octachron>
@mrvn, when using this workaround, using two underscore "m__N" can lead to better compiler messages when "-short-path" is used
yegods has quit [Remote host closed the connection]
freusque has quit [Ping timeout: 260 seconds]
FreeBirdLjj has joined #ocaml
zpe has quit [Remote host closed the connection]
sh0t has joined #ocaml
yegods has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
agarwal1975 has joined #ocaml
yegods has quit [Remote host closed the connection]
yegods has joined #ocaml
shinnya has quit [Ping timeout: 244 seconds]
freusque has joined #ocaml
bruce_r has joined #ocaml
ijbh has quit [Quit: Page closed]
freusque has quit [Ping timeout: 260 seconds]
freusque has joined #ocaml
ryanartecona has joined #ocaml
soupault has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 276 seconds]
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
rgrinberg has joined #ocaml
yegods has quit [Remote host closed the connection]
rgrinberg has quit [Ping timeout: 265 seconds]
freusque has quit [Quit: WeeChat 1.4]
haesbaert has quit [Remote host closed the connection]
dxtr has quit [Ping timeout: 265 seconds]
dxtr has joined #ocaml
nicholasf has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 265 seconds]
FreeBirdLjj has joined #ocaml
<orbifx1>
are there bindings for OGRE or any other engine?
<adrien>
I think axiles has made some for ogre but generally it's a fairly difficult topic because most C++ engines rely on you implementing derived classes
<orbifx1>
yeah.. idiotic..
<orbifx1>
There is one thing about devivation of OOP style.. it sends you looking for FP :P
copy` has joined #ocaml
<Algebr`>
well, why idiotic, kinda makes sense
manizzle has quit [Ping timeout: 244 seconds]
<orbifx1>
axiles: here?
<adrien>
C++-ic
pyon has quit [Quit: goddammit emacs]
<orbifx1>
adrien: got a link?
<adrien>
its almost impossible to properly bind to other languages
<adrien>
orbifx1: not at hand
pyon has joined #ocaml
<adrien>
let's see if grep does
<orbifx1>
I found his github account i think, but nothing there
<orbifx1>
Algebr`: Objects make sense.. Object orienting everything doesn't because it doesn't play out how you expect. That is my view based on my experience.
mpenet has left #ocaml ["ERC Version 5.3 (IRC client for Emacs)"]
larhat1 has quit [Read error: Connection reset by peer]
larhat has joined #ocaml
soupault has quit [Remote host closed the connection]
<orbifx1>
thanks for these adrien
ygrek has quit [Ping timeout: 255 seconds]
larhat1 has joined #ocaml
larhat has quit [Read error: Connection reset by peer]
manizzle has joined #ocaml
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
<Bluddy[m]>
does Core have an iterator type like Containers' seq/gen?
AlexDenisov has joined #ocaml
<companion_cube>
yeah, Core.Sequence
<companion_cube>
it's what I proposed in the PR for iterators in the stdlib
<companion_cube>
but this PR is stuck
Bluddy has joined #ocaml
<orbifx1>
what is the best option fo someone to render 3d graphics with OCaml?
<octachron>
*If* low level opengl is fine with you, I would say the tgls binding
<orbifx1>
octachron: looks like I'm going that way, unless there is something higher level?
CuriousErnestBro has quit [Ping timeout: 248 seconds]
AlexDenisov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<octachron>
orbifx1: there are some higher level libraries. However, as far as I know, none of them are up-to-date.
AlexDenisov has joined #ocaml
slash^ has joined #ocaml
<orbifx1>
-_-
<orbifx1>
thanks octachron, will go with OpenGL. Good to learn anyway
nicholasf has joined #ocaml
<octachron>
orbifx1: important precision, I meant that there some higher level opengl libray, I am not sure about generic 3d graphics library.
<orbifx1>
ok.
<orbifx1>
I asked teh channel, not much being said. Also that;s what I'm getting from searching around
nicholasf has quit [Ping timeout: 265 seconds]
danieli has quit [Changing host]
danieli has joined #ocaml
kamog has quit [Remote host closed the connection]
<smondet>
octachron: I think LablGL is hight-level but I think it's for and old-ish version of OpenGL (which also means a "portable" version of OpenGL :) )
<smondet>
*higher-level
<octachron>
smondet, LablGl is high-level but it is essentially opengl 1
MercurialAlchemi has joined #ocaml
<orbifx1>
smondet, octachron: lablgl also still depends to camlp4 according to OPAM. So it's also "portable" (lol) ocaml :P
<Bluddy[m]>
companion_cube: thanks for the pointer. I don't see a function to convert, say, a list to a sequence though, like you have. What am I missing?
<Bluddy[m]>
rightfold: which standard library are you using?
<rightfold>
Core
<Bluddy[m]>
thanks
<Bluddy[m]>
Did you use real world ocaml?
darkf_ has joined #ocaml
<rightfold>
I skimmed it
<rightfold>
I'm learning by trial and error :P
<Bluddy[m]>
ok good. I just wanted to get a sense of how a newcomer is entering the world of OCaml.
snhmib has joined #ocaml
<Bluddy[m]>
who watched Leo's pure OCaml talk?
<rightfold>
no
<Bluddy[m]>
sorry rightfold, that wasn't targeted at you but at the general community
AlexDenisov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Bluddy[m]>
anyone watched lpw's talk?
<rightfold>
oh I misread that :P
darkf has quit [Ping timeout: 265 seconds]
struk|desk has joined #ocaml
<orbifx1>
Bluddy[m]: no, what is it about?
<Bluddy[m]>
orbifx1: it's linked on the ocaml reddit. It's about turning OCaml into a pure language with effect types.
<Bluddy[m]>
orbifx1: it all stems from the multicore runtime. Algebraic effects were introduced to make multicore fit what people wanted, but they're not type safe, so now they're trying to have the type system include effects.
larhat1 has quit [Quit: Leaving.]
<Bluddy[m]>
rightfold: I think you have the right idea, but you don't want to make nnc_client.mli unless you have a matching, concrete nnc_client.ml. mli files describe their corresponding ml files.
<rightfold>
oh
<Bluddy[m]>
A .ml file can exist without a .mli file (and export everything), but not vice versa.
<rightfold>
I could rename it to nnc_client.ml and wrap the stuff in module type Sig = sig ... end?
<Bluddy[m]>
Yeah. And then you don't need 'module type of Nnc_client' -- just use Nnc_client.Sig.
<rightfold>
right
<Bluddy[m]>
you probably also need to constrain t in your Make functor ie. not just config.
<rightfold>
it's opaque
<rightfold>
thanks a lot :)
<Bluddy[m]>
It'll still be opaque from the point of view of the calling code outside of the functor, but the typechecker needs to know what it maps to. Functors are some of the hardest parts of OCaml because you really have to think like the typechecker, and there are few shortcuts and no inference to help you out.
<Bluddy[m]>
The other gotcha in OCaml is polymorphic comparison. Always beware of using (=) on generic types.
<rightfold>
I'm aware of that
<Bluddy[m]>
ok. If you've got these 2 down, you're good to go :)
orbifx1 has quit [Quit: WeeChat 1.5]
yegods has quit [Remote host closed the connection]
<ggole>
jstolarek: man getlogin and look for that error
<flux>
it's probably "you don't exist, go away"
<flux>
but yeah, my suggestion probably works better. you are going to always have a user id :)
<jstolarek>
got it
NingaLeaf has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jstolarek>
the answer is that getlogin does not work :-)
<jstolarek>
what works is: getpwuid(getuid())
yegods has joined #ocaml
yegods has quit [Remote host closed the connection]
NingaLeaf has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
profmaad has quit [Ping timeout: 265 seconds]
profmaad has joined #ocaml
seangrove has joined #ocaml
yegods has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
Intensity has quit [Remote host closed the connection]
Intensity has joined #ocaml
<companion_cube>
Bluddy[m]: I don't know much about Core.Sequence's API, sorry
orbifx has joined #ocaml
<orbifx>
does anyone know if BatString.nsplit is more efficient than Str.split (which is using regexp)?
<companion_cube>
it probably is, yes
<flux>
regardless of the efficiency
<companion_cube>
(but in doubt, benchmark!)
<flux>
don't use Str!
<flux>
at the very least if it might ever happen you want to use threads in the lifetime of that program or library.
osa1_ has joined #ocaml
osa1_ has left #ocaml ["Konversation terminated!"]
AlexDenisov has joined #ocaml
osa1_ has joined #ocaml
<osa1_>
I have a signature defined in ui.ml and two modules with the signature defined in tui.ml and fancy_tui.ml. I was hoping to use the signature defined in ui.ml in the client code but is it even possible?
<osa1_>
It seems like I can't even use the signature as type
<osa1_>
e.g. I have a function `let f (ui : Ui.Ui) = ...` here I get an error because Ui.Ui is a signature
igt0 has quit [Quit: Connection closed for inactivity]
<flux>
hmm, I can't make it shorter than this: module Foo = struct let a = 42 end module type T = module type of Foo let f (ui : (module T)) = ()
<orbifx>
flux: threads? Str doesn't support thm?
<flux>
orbifx, it doesn't, it's actively hostile against them
<orbifx>
"actively" hostile? :P
<flux>
it has secret hidden state you cannot see, used by functions that you wouldn't think that they have one
<flux>
Str.split will fail if you use it at the same time from many threads
<flux>
because it's based on the hidden-state-functions the modle exposes
<orbifx>
thanks for the definitive answer btw, normally I get some esoteric responses to these kind of questions
<orbifx>
eww, why not banish Str then?
<flux>
I know this after debugging a many-thread-ocaml-program that sometimes disconnected devices becase the protocol parser gave the most curious results
<flux>
legacy..
ryanartecona has joined #ocaml
<flux>
maybe the multicore project or others have fixed it with thread-local storage
Ravana has quit [Ping timeout: 240 seconds]
<flux>
I doubt that..
<orbifx>
ok no Str then.. thanks
<flux>
there are great alternatives available
<flux>
I used to like - and still like - the pcre module
<flux>
but if you value purity, then perhaps the re is for you
<flux>
personally I think Pcre is simpler to use..
<orbifx>
I like purity yes
<orbifx>
Re?
<flux>
it's pure ocaml
<orbifx>
Ow the facebook variant?
<flux>
what?
<reynir>
It's not Reason (?)
<flux>
the facebook variant was called 'reason', not 'pure' :)
<companion_cube>
"re" is a regular OCaml regex library
<companion_cube>
it also provides compatiility layers with Str and the likes
<orbifx>
thanks
<flux>
but I don't think its pcre layer is complete
Ravana has joined #ocaml
octachron has joined #ocaml
<flux>
also opam install re works :)
<companion_cube>
well, I don't think it does backtracking as does pcre
<companion_cube>
otoh it's pure OCaml
<orbifx>
thanks will check it out if I need any heavy regexs
<flux>
pcre's negative lookahead is pretty nice, I don't think re supports it
<flux>
also I don't think the perl support supports evaluating arbitrary perl fragments.. ;)
NingaLeaf has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<orbifx>
:P
<osa1_>
I'm trying objects. is there a way to define an existential type in an object? I want to return something abstract from a method that can be used when calling another method. multiple object definitions should be able to use different types
<orbifx>
ok going to need re turns out :P
<flux>
but with some work I bet it could support evaluating ocaml functions.
<flux>
osa1_, would parametrizing the class by a type do?
<osa1_>
flux: I don't think so, the whole point is to avoid adding parameters because parameters are not interchangeable
<orbifx>
flux are there docs anywhere for re?
<flux>
orbifx, look at the .mli files I guess
<flux>
osa1_, then how about a polymorphic method?
<orbifx>
i was afraid I'd have to..
<osa1_>
hmm I'll need to see what that is
<flux>
I think you do want to parametrize classes by a type
<flux>
class ['type] c = object val value : 'type option = ref None method set x = value := x method get = !value end
NingaLeaf has joined #ocaml
<osa1_>
I'm getting a syntax error
<osa1_>
what is [] around 'type? is that valid?
<flux>
heh, it turns out 'type is invalid
yegods has quit [Remote host closed the connection]
<ggole>
That's because 'type is not a valid type variable name
<flux>
so that's why 'ty is so popular
<ggole>
Use 'a instead
<flux>
also there's another bug, it shold be 'ty option ref
<osa1_>
it doesn't let me share my session though.. anyway
<flux>
that's a nice idea. I wonder if it exists.
<flux>
I think the online ocaml toplevels usually run on the client, so that'd be a bit difficult, unless you mean a version that doesn't share in real time
<flux>
maybe one with a "share link" that would share the current state of the repl on the server wold be easier. but could still be complicated to implement perhaps..
<osa1_>
actually I can see now that my existential type idea wouldn't work. I think what I need is something like what you showed (except it should actually valid OCaml ;-)
<osa1_>
should be*
<osa1_>
oh so I still need []s around the type. OK now it's working
Muzer has quit [Read error: Connection reset by peer]
<flux>
ocaml objects are pretty cool. sadly they are an advanced topic.
slash^ has quit [Read error: Connection reset by peer]
<Bluddy[m]>
flux: sadly also, a) they're complex b) they perform poorly c) nobody's interested enough in them to get past their complexity and poor performance
<osa1_>
OK so can I implement this using modules? the parameter here would be an abstract type of the module
<osa1_>
modules*
<flux>
well, the performance really matters only if you're doing like a million integer objects, no?
<flux>
as a tool to structure programs they should be alright
<flux>
I mean people are writing programs in python, aren't they :P
<orbifx>
flux: is the general sequence for a split something like: Re.(split (compile (Re_posix.re ....))) string ?
<orbifx>
flux: unfortunately they are :P
<flux>
orbifx, looks ok, except you probably want to lift the compilation out if you're doing a lot of that
<rightfold>
What is M.(f x) syntax? I've seen it several times.
<flux>
rightfold, it's the same as let open M in f x
<osa1_>
obviously OCaml people have better standards :p
<rightfold>
Oh right, that makes M available in the expression
<orbifx>
flux: yeah
Muzer has joined #ocaml
<Bluddy[m]>
flux: It's true, but python is getting faster all the time, and the rest of the competition never sleeps (node.js, Switft, F#, Scala). Presumably people are using OCaml because they care somewhat about performance.
<Bluddy[m]>
I'm actually really surprised this complex object model made it into the language in the first place.
<reynir>
Is swift slow?
<flux>
perhaps the new ocaml optimizer will at some day employed for ocaml objects as well, to enhance caching or methods etc
<Bluddy[m]>
flux: The problem is you're starting from a much more complex model, whereas the standard nominative object model all other common languages use is easy to implement efficiently.
<flux>
bluddy[m], well yes, but if you're going to use such systems, you might almost just as well use records of functions and get decentish performance.
<rightfold>
The new Scala compiler will optimize structural types too
<flux>
bluddy[m], or would you suggest to not go away with structural typing/row polymorphism but instead simplify ocaml objects in some other way?
<Bluddy[m]>
flux: classes have their place with open recursion. There was pretty much no need to make objects structural.
<Bluddy[m]>
It would be nice if the compiler could identify when you're using a standard inheritance hierarchy and optimize to use virtual tables as in other languages.
<Bluddy[m]>
Knowing virtually nothing about the history of the object part of OCaml, I'm going to venture a guess that somebody needed to write some novel research work. It's a slightly educated guess.
igt0 has joined #ocaml
trystero is now known as tristero
<Bluddy[m]>
companion_cube: What do you think of the prospects of Janestreet Base becoming the de facto stdlib? Would you switch rather than use your Containers for the sake of unity?
<osa1_>
amazing, I solved my problem with first class modules
<orbifx>
flux: does Re_posix have any peculiarities with ^$ notations?
<companion_cube>
Bluddy[m]: I don't know
<companion_cube>
it's a lot of code to rewrite
<companion_cube>
I'd like them to provide compatibility with the stdlib, actually
<companion_cube>
(and I'm a bit afraid that they will keep their development somehow closed)
<companion_cube>
(i.e. high barrier of entry for contribution, and they would decide what changes anyway)
<Bluddy[m]>
I don't think there will ever be compatibility with the stdlib
<Bluddy[m]>
But new people are going to flock to Core/Base anyway (partially via RWO)
<Bluddy[m]>
Given the fact that they've already moved to reduce the compilation/dependency overhead (a common community complaint), I'd expect them to be more open about development as well.
<Bluddy[m]>
Could be wrong of course.
<Bluddy[m]>
You yourself said that you wish your implementation of map had used ~f. That's not stdlib-compatible, and it's their common idiom.
ggole has quit []
<companion_cube>
well I kind of wish it, but otoh I don't want to break cod
<companion_cube>
e
<companion_cube>
including my code
<companion_cube>
also, I'm annoyed that Base seems to assume OCaml >= 4.03
<Bluddy[m]>
I'm not talking about breaking anything, but rather about a gradual adoption/transition model.
<companion_cube>
Core breaks my code
<Bluddy[m]>
huh?
<companion_cube>
anything not like the stdlib breaks my code, basically
<companion_cube>
I mean I cannot just abandon the stdlib like that without rewriting a lot of code
<companion_cube>
which takes time and willpower
<Bluddy[m]>
Yeah but for your next project you can choose to switch
<companion_cube>
meh
<companion_cube>
I'm not even sure they have all I need (no IO code right now?!)
<companion_cube>
(no iterators, if I understood correctly?)
<Bluddy[m]>
They're there, I just missed them
<Bluddy[m]>
iterators, that is
<companion_cube>
ah! cool
<companion_cube>
so they're the same as Core.Sequence?
jstolarek has quit [Ping timeout: 250 seconds]
<Bluddy[m]>
yeah. exact same
<Bluddy[m]>
AFAICT
<companion_cube>
I don't know why yminsky doesn't push more for standardizing those
<flux>
if the next project is a library, you're sort of choosing sides if you make it to expose any data structure Core provides
<companion_cube>
I avoid depending on stdlib extensions, in libraries
<companion_cube>
(even containers)
<flux>
..and even just as an internal dependency, but I guess that's alright for all but the binary size
<flux>
companion_cube, but as a concept it feels so limiting
<companion_cube>
well, yes, but I dislike cabal hell
<companion_cube>
(and libraries that depend on core or batteries, fwiw)
darkf_ is now known as darkf
wolfcore has quit [Ping timeout: 265 seconds]
wolfcore has joined #ocaml
<orbifx>
flux: the simple ^---$ pattern is not working, althgouh it was working with Str.. any ideas?
<flux>
orbifx, nope
<flux>
I've only used the Re_pcre module I think
<orbifx>
and I see the re_str.mli seems like a copy of Xavier's code, is that still compatible with the rest of Re?
<companion_cube>
afaik re_str compiles Str-like regexes into Re's internal combinators?
<orbifx>
seems like it
<orbifx>
mutable fields :/
nicholasf has joined #ocaml
osa1_ has quit [Ping timeout: 248 seconds]
Denommus has joined #ocaml
_andre has quit [Quit: leaving]
nicholasf has quit [Ping timeout: 244 seconds]
bruce_r has quit [Ping timeout: 248 seconds]
jstolarek has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
yegods has quit [Remote host closed the connection]
yegods has joined #ocaml
jstolarek has quit [Ping timeout: 272 seconds]
rgrinberg has joined #ocaml
AlexDenisov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bruce_r has joined #ocaml
octachron has quit [Quit: Leaving]
<Bluddy[m]>
i wonder what the result would be if i held a poll to see who would switch over to Base as their primary library
randomA has joined #ocaml
<randomA>
hey friends
<randomA>
im really scared half this channel is my prof, other students, and a bunch of TAs
<randomA>
because literally my school is the only one i know that uses this language
<randomA>
but anyway, ive a question
<randomA>
about graphs
snhmib has quit [Quit: WeeChat 1.3]
jstolarek has joined #ocaml
<tane>
randomA, what is your question then?
<randomA>
how do i parse a json file into a graph
<tane>
what kind of graph?
<randomA>
so the assignment is a text adventure game. Oriignlly, iwas going to represent the rooms in the game as a tree, but i think a graph is better
<randomA>
and like a data structure graph
<tane>
yes, makes sense
<randomA>
ok
<randomA>
so im unsure oof how to repersent game sttes
<randomA>
like the state of the game
<randomA>
like how many points user has, which rooms we've already hit, what items we holding, how much time has passed
<randomA>
is this all in a record that I keep changing, or do I make a diff after every turn and then change the record
<Drup>
someone asked earlier, but not online anymore
fraggle_ has joined #ocaml
Jaxan has joined #ocaml
<randomA>
tane: so you know git?
<randomA>
like version control?
<tane>
yes
<randomA>
i think the way they work is by using diffs to update and only updating what changes instead of rewriting the entire thing
<randomA>
i thought i should do that, or do you think that is unnecessary? I'm unsure how to represent states whether to have a stack of diff types
<randomA>
or...not diff types, like stack of states
<randomA>
or maybe just have one state
al-damiri has quit [Ping timeout: 265 seconds]
<randomA>
and in state just have a assoc list for the different objectives of the game like whether we've reached each room, whether all items are in designated location
<tane>
well, that depends whether you want the user to be able to undo actions?
<randomA>
tane: i don't think that will be necessary
fUD has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 248 seconds]
<randomA>
so I have a State record that holds references to which room it is in in the graph, and then just assoc lists of objectives?
orbifx has quit [Quit: WeeChat 1.5]
<tane>
well, I'd probably do it that way, yes
<randomA>
tane: so I forget the diff stuff
<tane>
not sure about the objectives, but regarding the game-state, sure, if there's no requirement for a solid history of steps, why record them?
<randomA>
tane: i mean, that's just my idea. the assignment is very open to interpretation
<randomA>
I PM you assignment link in case prof/ta lurking which im sure they are
al-damiri has joined #ocaml
ee_ks has quit [Quit: Leaving.]
NingaLeaf has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jstolarek has joined #ocaml
silver_ has quit [Quit: rakede]
yegods has quit [Remote host closed the connection]