<bmintz>
i was a python user but love functional compiled languages, so hopefully i can join the fun. if i do
<bmintz>
`let x = 42`, my understanding was that x is immutable. so how come i can do `let x = x + 1` afterwards?
FreeBirdLjj has joined #ocaml
<tautologico>
bmintz: you're not mutating x, you're creating a new variable named x that shadows the previous one
<bmintz>
ah
<bmintz>
what do you mean by shadow
<tautologico>
it hides the previous variable
<tautologico>
like a variable local to a function shadows a global/toplevel variable
<bmintz>
so what do you mean by hide
<bmintz>
ohhh
<bmintz>
where is the old x? is it deleted in memory?
<tautologico>
if the GC determines it is not used anymore, its memory will be freed
<bmintz>
so it would be deleted in this case right?
<tautologico>
yes
FreeBirdLjj has quit [Ping timeout: 268 seconds]
<bmintz>
so then, if x is really big in RAM, which is faster: `let x = ref <big thing that supports +>` `x := !x + y` or `let x = <big thing>` `let x = x + y`
spew has joined #ocaml
<bmintz>
ignore my first clause lol
<tautologico>
it's hard to tell,
<bmintz>
why is that
rpg has joined #ocaml
unbalancedparen has joined #ocaml
<tautologico>
depends on x and other details
spew has quit [Quit: foobar]
<bmintz>
oh
al-damiri has quit [Quit: Connection closed for inactivity]
ohama has quit [Ping timeout: 264 seconds]
ohama has joined #ocaml
bbc has quit [Ping timeout: 255 seconds]
bbc has joined #ocaml
jonatin has quit [Quit: jonatin]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
jmiven has quit [Read error: Connection reset by peer]
jmiven has joined #ocaml
ygrek has quit [Ping timeout: 260 seconds]
ygrek has joined #ocaml
rseymour has joined #ocaml
ygrek has quit [Ping timeout: 258 seconds]
ygrek has joined #ocaml
psacrifice has quit [Remote host closed the connection]
psacrifice has joined #ocaml
freusque has quit [Ping timeout: 264 seconds]
argent_smith has joined #ocaml
hovind has joined #ocaml
cokanut has quit [Ping timeout: 240 seconds]
govg has quit [Ping timeout: 240 seconds]
zpe has quit [Remote host closed the connection]
govg has joined #ocaml
freusque has joined #ocaml
n4323 has quit [Quit: WeeChat 1.7]
kakadu has joined #ocaml
psacrifice has quit [Ping timeout: 240 seconds]
psacrifice has joined #ocaml
freusque has quit [Read error: No route to host]
silver has joined #ocaml
freusque has joined #ocaml
cokanut has joined #ocaml
cokanut has quit [Ping timeout: 260 seconds]
mfp has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
Onemorenickname has joined #ocaml
<Onemorenickname>
Hello people
<Onemorenickname>
I was wondering if there was an "Include with" for module type signatures
<Onemorenickname>
for instance, in my type signature, there is a type t, and I want to include an other module with type t = t
<Onemorenickname>
When I use "with type t = t", I get "several definition of the same type"
<mrvn>
try type temp = t and with type t = temp
psacrifice has quit []
octachron has joined #ocaml
cokanut has joined #ocaml
zpe has joined #ocaml
<octachron>
Onemorenickname, destructive substitution should work for this use case, e.g.: "sig type t include (sig type t val x:t end with type t := t) end"
larhat has joined #ocaml
<Drup>
octachron: I like damien's answer 22 days after your message explaining how the OCaml syntax is full of cruft
<Onemorenickname>
octachron and mrvn, actually, my code's structure was bad
<Onemorenickname>
But I keep those in my head, thanks :)
FreeBirdLjj has joined #ocaml
govg has quit [Ping timeout: 246 seconds]
<octachron>
Drup, but for once OCaml shares the same cruft as the C language family: the use of "<" and ">" as both brackets and operators as a consequence of ascii tyranny
<def`>
:D
maattdd has quit [Ping timeout: 260 seconds]
larhat has quit [Quit: Leaving.]
ngWalrus has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
maattdd has joined #ocaml
trapz has joined #ocaml
trapz has quit [Quit: trapz]
Onemorenickname_ has joined #ocaml
Onemorenickname has quit [Ping timeout: 240 seconds]
cokanut has quit [Quit: Lost terminal]
zpe has quit [Ping timeout: 246 seconds]
snowcrshd has joined #ocaml
trapz has joined #ocaml
rpg has joined #ocaml
larhat has joined #ocaml
BitPuffin|osx has joined #ocaml
trapz has quit [Quit: trapz]
hovind has quit [Ping timeout: 260 seconds]
jnavila has joined #ocaml
trapz has joined #ocaml
nomicflux has joined #ocaml
trapz has quit [Client Quit]
wtetzner has joined #ocaml
nomicflux has quit [Quit: nomicflux]
alfredo_ has joined #ocaml
wtetzner has quit [Remote host closed the connection]
alfredo has quit [Ping timeout: 240 seconds]
rpg has quit [Ping timeout: 240 seconds]
jnavila has quit [Ping timeout: 240 seconds]
trapz has joined #ocaml
zpe has joined #ocaml
Onemorenickname has joined #ocaml
Onemorenickname_ has quit [Ping timeout: 240 seconds]
toolslive has joined #ocaml
toolslive has quit [Ping timeout: 240 seconds]
jabroney1 has joined #ocaml
spew has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
toolslive has joined #ocaml
nbrd has quit [Quit: Page closed]
yomimono has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 246 seconds]
sh0t has joined #ocaml
P4Titan has joined #ocaml
<P4Titan>
Hi all.
<P4Titan>
The following seems to evaluate at program start up and retain its value all throughout execution, even if the reference changes
<P4Titan>
let item_exists = flip BatMap.mem !items_map
<flux>
octachron, the rule is plain and simple: syntax uses ; as a separator --> C
<P4Titan>
even though `item_exists` is a function, not a constant
<companion_cube>
P4Titan: indeed, it is evaluated once
<companion_cube>
you should probably write `let item_exists x = BatMap.mem x !items_map`
<P4Titan>
that's what I ended up doing
<P4Titan>
but why?
<P4Titan>
`item_exists` is a function?
<P4Titan>
I understand for constants
<companion_cube>
because of side effects, `f` and `fun x-> f x` are not always the same
<companion_cube>
and !foo is a side effect :-)
toolslive has quit [Ping timeout: 240 seconds]
<Onemorenickname>
Hi people
<P4Titan>
so a general rule is that let <something> = ... evals once at start up and never again
<octachron>
Onemorenickname, you are lacking the type equality Complex.b = Simple.a
<Onemorenickname>
octachron, what does the line " module Elt : SIMPLE_TYPE with type a = b;;" ?
<Onemorenickname>
I thought that's how you specified such equality
<P4Titan>
yes
<P4Titan>
but that only holds for within `COMPLEX_TYPE`
<Onemorenickname>
it is not exported ?
djellemah_ has quit [Quit: Leaving]
<P4Titan>
here's what I imagine
<Onemorenickname>
"Elt = Simple" does not imply "type a = b" ?
djellemah has joined #ocaml
<Onemorenickname>
Furthermore, when I add "and type b = Simple.a" in line 12, I still get the same error
<P4Titan>
take module A : sig type a end = struct type a = int end
<P4Titan>
and module B : sig type a end = struct type a = char end
<P4Titan>
both A and B would be of SIMPLE_TYPE
<theblatte>
P4Titan: yes, all values are evaluated when the module is loaded and functions are values. OTOH in let foo x = ..., foo is waiting for an argument to evaluate the body.
<P4Titan>
theblatte: yes, ty
<theblatte>
hmm, not the clearest explanation, I lack terminology for "values" :)
<P4Titan>
Onemorenickname: you see what I mean
<Onemorenickname>
P4Titan, so far, yes
<P4Titan>
SIMPLE_TYPE implies a module that only has an abstract type. That doesn't mean that all modules that have said type sig will have the same `type a` underneath
<Onemorenickname>
Indeed
unbalancedparen has joined #ocaml
<octachron>
Onemorenickname, the order matters: "module Complex : COMPLEX_TYPE with type b = Simple.a and module Elt = Simple"
<P4Titan>
and you have nothing binding the type in `module Comple : COMPLEX_TYPE` to `module Simple : SIMPLE_TYPE`
<P4Titan>
^^^ that binds the types
<P4Titan>
explicitly
<sspi>
I'm trying to build a toplevel with js_of_ocaml, however I'm getting a error when JsooTop.initialize() is ran. I can't completely see the error due to the object structure, but it seems like an issue with Pervasives. Has anyone ran into this?
<Onemorenickname>
Oh, there is no inference.
<Onemorenickname>
At all.
<Onemorenickname>
Only checking when it is compiled
<Onemorenickname>
octachron, yep : the error told me that when I did "module Elt = simple", there was some shit going on, as "type b" was not yet equal to "Simple.a"
<P4Titan>
you have to be fairly explicity in OCaml when you're working w/ types
<P4Titan>
in my expirience
<Onemorenickname>
(A promise of ocaml is that with type inference, you don't have to write types)
<Onemorenickname>
(I've never been so wrong.)
<P4Titan>
but this is not really inference, more so, type conflation
<P4Titan>
Where Simple could have any type and Complex any other type
<octachron>
Onemorenickname, not at the module level… The problem is that inference becomes undecidable relatively fast when the complexity of type system increases
<P4Titan>
and you want OCaml to bring them together
marsam has joined #ocaml
shinnya has joined #ocaml
<Onemorenickname>
P4Titan, nope, because inside "Complex", there is the equality
<Drup>
Onemorenickname: a promise of OCaml is to infer as much stuff as possible
<Onemorenickname>
It is redundant
<Drup>
that's a bit different than "everything" ;)
<Onemorenickname>
Drup, when I've been taught Ocaml, I was told that it could infer everything but GADT
<P4Titan>
Onemorenickname: but inside `Complex`, the type a there doesn't have to be the same as the type a of the `Simple`
<Drup>
Onemorenickname: for the *expression language*, this is true
<Drup>
The module language .. that's another piece of work
<Onemorenickname>
I'm seeing so
<Onemorenickname>
P4Titan, that's what says " module Elt : SIMPLE_TYPE with type a = b;;"
<P4Titan>
I could be mistaken, so please correct me anyone if neccessary
<P4Titan>
BUT
<P4Titan>
in `type a = b`, the type `a` doesn't neccesarily have to be the same as the type `a` that `module Simple : SIMPLE_TYPE` brings forth
<Onemorenickname>
P4Titan, that's what it means though
<Onemorenickname>
It's not a type declaration
sepp2k has joined #ocaml
<P4Titan>
doesn't the `with module Elt = Simple` basically override the `with type a = b`
<P4Titan>
u are saying "use this version of Elt"
<P4Titan>
in FINAL_TYPE
<P4Titan>
its something like that
<P4Titan>
I don't think it takes the "use this version of Elt" and that applied "type a = b" to that
<P4Titan>
it just assumes that the version of Elt you provide obeys said relationship
<Drup>
it doesn't "assumes"
<Drup>
it checks.
<P4Titan>
ya, checks the assumption
<P4Titan>
:D
<Drup>
you can't shadow earlier type constraints that way, all of them hold. While the order does matter, it's only in order to keep the system consistent, not for "overriding"
<P4Titan>
ic
<P4Titan>
the effect is similar, I just didn't use the most correct diction
<P4Titan>
terminology*
<P4Titan>
yes
<Onemorenickname>
I'm getting an error at a higher level
<Onemorenickname>
I'm sure that if I master the module stuff, I'll be able to become an Ocaml-Meister
<octachron>
Onemorenickname, as a general rule signature constraint erases information: you should look at the type inferred for the functors Siders, Complexers without the signature constraint
<Drup>
your functors need to export more equalities
rpg has joined #ocaml
<Onemorenickname>
Drup, that's what I'm seeing
al-damiri has joined #ocaml
<Onemorenickname>
But I don't understand why functors need to export equalities
<Onemorenickname>
I'm basically meditating until I reach enlightment right now
<Drup>
well, otherwise, you don't know that Sider(Foo).Complex is equals to Foo
<Onemorenickname>
Well, isn't that what's written in the functor ?
<Drup>
yes, it's written *in* the functor
<Onemorenickname>
Quite literaly
<Drup>
but not in the type signature you slapped on it :p
<Onemorenickname>
OH.
<Onemorenickname>
I just remembered : I try to make functorish signatures, and then applying to signatures to module signatures and it did not work
<Onemorenickname>
And I was like "if I can't do that, how can I specify that ?"
<Onemorenickname>
Well. That's how you do it.
<Onemorenickname>
Thanks :D
<Drup>
I believe you are now enlightened :p
<Onemorenickname>
Thanks Brudha
<Onemorenickname>
(It's fun, because it's a mix of "Drup" and "Buddha", and sounds like ghetto "Brother")
<Onemorenickname>
I now have a consistent representation of the functors type system, omg
gtristan has joined #ocaml
<gtristan>
Okaaay, so; I'm trying to put together an ocaml + ocaml findlib build, because something else I'm building requires it
<gtristan>
So far so good, although I'm not sure I have the correct sources
<gtristan>
Now, when building guestfish "supermin" thingie which requires it, it passes configure and then chokes on invocations such as: ocamlfind ocamlc -warn-error CDEFLMPSUVXYZ-3 -package unix,str -c supermin_utils.mli -o supermin_utils.cmi
<gtristan>
or am I grabbing it in the wrong place ?
<Drup>
gtristan: iirc, it's the right thing
<Drup>
-package comes from ocamlfind
<gtristan>
hmmm, so the above incantation would be wrong ?
<gtristan>
it would have to have -package before ocamlc ?
<Drup>
no, it's fine, it calls ocamlfind
<Drup>
the order does not matter
<Drup>
(well, it does, but you can mix ocamlfind options and ocamlc options)
<gtristan>
Ok, strange, I'm in a build shell with all this staged, if I move -package unix,str before ocamlc in that line, then I dont get that error anymore, and a dump of symbols is printed to console
<gtristan>
unix_socket
<gtristan>
unix_connect
<gtristan>
unix_bind
<gtristan>
unix_socketpair
<gtristan>
...
<gtristan>
like that
* gtristan
is certain that he built it wrong, somehow
argent_smith has quit [Quit: Leaving.]
<gtristan>
ocaml is built with: ./configure --prefix /usr && make world.opt && make DESTDIR=/path/to/destdir install
<gtristan>
ocaml-findlib with: ./configure -bindir /usr/bin && make all && make prefix=/path/to/destdir install
<gtristan>
maybe some cache updating command I need to run after staging ? some ocaml equivalent of ldconfig ?
blackfry has quit [Ping timeout: 264 seconds]
jao has joined #ocaml
mcspud has quit [Ping timeout: 264 seconds]
* gtristan
might have a very old ocaml with brand spanking new ocaml-findlib
<Drup>
(or use your package manager, really. Ocaml and findlib are in most distributions)
<gtristan>
Drup, tarballs are a no go, at least I'm trying to avoid them except for circular deps (i.e. need perl for automake and vise versa)
<gtristan>
and package manager also a no go :)
<Drup>
I don't understand, but ok
<gtristan>
The whole point here is to build everything, from cross-bootstrap to desktop env, entirely deterministically and from git sources; separating build from deployment
<gtristan>
I know, context is missing :)
<gtristan>
The reason I want guestfish is to help in deploying filesystem images, without mounting them loopback (which requires root)
<Drup>
then yeah, use the last stable tag
hovind has joined #ocaml
<Drup>
(not branch, tag.)
* gtristan
thinks he may have went overkill with guestfish, but it may cover some cases for installing bootloaders where it wont work easily with say, mke2fs -d /path/to/sysroot
<toolslive>
I tried to do that too, everything from source, in docker containers, with everything pinned to commit hashes. Even that does not produce reproducible builds.
<gtristan>
toolslive, reproducible builds are another thing, cannot afaics be done _only_ with build tooling
<gtristan>
but build tooling will indeed help
* gtristan
tried building without urandom the other day and failed in some python builds
<toolslive>
or, the distro suddenly has an upgrade for a package, that somehow trips you over.
zpe has quit [Remote host closed the connection]
<gtristan>
toolslive, I dont allow host tools as a rule actually
<gtristan>
so this should really not change things
<toolslive>
no host tools ? how do you get to a C compiler then ?
<gtristan>
even the bootstrap, or cross-bootstrap, needs to have some deterministic base
fraggle_ has quit [Read error: Connection reset by peer]
<gtristan>
think of it this way: If you can have it installed on hardware, you can also have an sdk to "chroot" (or bubblewrap) into
<gtristan>
things have been circular forever, we just dont allow host tools
<gtristan>
(gcc I think even needed a C compiler since it's first incarnation)
<gtristan>
Anyway, got further ! Now I have: Fatal error: the file '/usr/bin/ocamldep' is not a bytecode executable file
<gtristan>
Oh, and this is while building supermin !
* gtristan
checks
<gtristan>
/usr/bin/ocamlopt is symlink to -> ocamlopt.opt, which is a 7.2MB executable file
<gtristan>
Oh, seems I get that same error on multiple /usr/bin/ocaml* files
<gtristan>
Any idea what can be causing that ?
<gtristan>
I.e. this produces it in a shell: ocamlfind ocamlopt -warn-error CDEFLMPSUVXYZ-3 -package unix,str -c supermin_pacman.ml -o supermin_pacman.cmx
toolslive has quit [Ping timeout: 258 seconds]
<octachron>
gtristan, it sounds like ocamlfind is attempting to use ocamlopt as a bytecode version, you should try ocamlfind "ocamlopt -only-show …"
<gtristan>
that is the response I get, with: ocamlfind "ocamlopt -only-show -warn-error CDEFLMPSUVXYZ-3 -package unix,str -c supermin_pacman.ml -o supermin_pacman.cmx"
<gtristan>
ultimately, I should either be fixing my ocamlfind build to _not_ ask for a "bytecode version", or, I should fix the ocaml build itself to install the bytecode versions, right ?
myst|fon has quit [Quit: Connection closed for inactivity]
<mrvn>
gtristan: gcc needs a c++ compiler now
<gtristan>
mrvn, annoying yes
dmoerner has quit [Quit: leaving]
<gtristan>
eh... 1am is time to forcefully stop yourself from hacking, I'll try again tomorrow
<octachron>
gtristan, sorry I meant "ocamlfind ocamlopt -only-show … " which should normally yields "ocamlopt.opt …" and the same thing for ocamldep
toolslive has joined #ocaml
shinnya has quit [Ping timeout: 268 seconds]
maattdd has quit [Ping timeout: 260 seconds]
zpe has joined #ocaml
Onemorenickname has quit [Quit: Leaving]
P4Titan has quit [Ping timeout: 240 seconds]
pilne has joined #ocaml
ryanartecona has joined #ocaml
<gtristan>
octachron, yields: Fatal error: the file '/usr/bin/ocamlopt' is not a bytecode executable file
<gtristan>
octachron, that is, with the whole command, or with only `ocamlfind ocamlopt -only-show` as well
mrvn has quit [Remote host closed the connection]
unbalancedparen has quit [Ping timeout: 240 seconds]