<hackinghorn>
I saw some codes and functions without ;; work :/
<d_bot>
<bnguyenvanyen> ;; is mostly for the toplevel, it tells it to evaluate the input. You don't need it otherwise.
<d_bot>
<bnguyenvanyen> The previous link will show you that to call the function from another file, you will need to put its module name in front. If it's in a.ml, it will be A.f.
<d_bot>
<bnguyenvanyen> But then you need to look at how to compile all this correctly (you can use dune), etc etc, so the other informations on the page will be useful.
<vsiles>
what he said :) thanks !
Haudegen has joined #ocaml
<hackinghorn>
ah thanks
olle_ has joined #ocaml
<olle_>
How do I know if my abstract syntax-tree sucks?
<olle_>
Or non-sucks
tane_ has joined #ocaml
smerdyakov has left #ocaml ["Leaving"]
<vsiles>
it sucks by default, doesn'i ?
<vsiles>
what do you mean by suck ?
<olle_>
vsiles: dunno. not sure which quality attributes are relevant. :d
Abhir-24 has joined #ocaml
bartholin has joined #ocaml
Abhir-24 has quit [Quit: Connection closed]
zebrag has joined #ocaml
<hackinghorn>
hi, so if I want to use a function in the same file it is written, I either have to use let sum x y = x + y in ... or let sum x y = x+ y;; ?
|jbrown| has quit [Ping timeout: 246 seconds]
<hackinghorn>
I saw something like, let sum x y = f x x y let ... = ..., there is no separators between 2 lets, does it always work?
<vsiles>
yes separators are only necessary from the interactive toplevel
<vsiles>
if you compile your file, you don't need them at all
|jbrown| has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
mfp has joined #ocaml
hackinghorn has quit [Ping timeout: 248 seconds]
kakadu has joined #ocaml
bronsen has quit [Quit: WeeChat 2.9]
bronsen has joined #ocaml
<qwr>
there is one exception - if you want top-level expression, then it needs ;; between it and preceding let (let something ... ;; expression - but you can alternatively use let () = expression for that purpose)
murgy has joined #ocaml
Haudegen has joined #ocaml
radiopotin[m] has joined #ocaml
curtosis has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
murgy has quit [Quit: Connection closed]
curtosis is now known as curtosis[away]
curtosis[away] has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
waleee-cl has joined #ocaml
shawnw has quit [Ping timeout: 246 seconds]
kakadu has quit [Ping timeout: 240 seconds]
murgy has joined #ocaml
curtosis has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
neiluj has joined #ocaml
neiluj has quit [Changing host]
neiluj has joined #ocaml
curtosis has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
kakadu has joined #ocaml
<d_bot>
<undu> I'm trying to test a module with alcotest, but the main type is a phantom type. (`type 'a t`, which is made concrete with `type 'a t = string`). I can't really create an `Alcotest.testable` out of it because the type checker complains about the type not being generalizable. Are there any strategies to resolve this short of removing the phantom type? I'd like to test the current code before removing the phantom type, which is not bei
<d_bot>
<Firgeis> You could add some pretty printing to the module and test that?
<d_bot>
<octachron> You could fix the polymorphic type variables and restrict the tests to `rigid t` rather than `'a t`
<d_bot>
<undu> defining the type `rigid` and using it for the testable module worked wonders, thanks!
<d_bot>
<undu> `let testable : (module Alcotest.TESTABLE with type t = rigid Module.t) = Alcotest.testable ...`
murgy has quit [Quit: Connection closed]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
narimiran has quit [Ping timeout: 260 seconds]
kakadu has quit [Read error: Connection reset by peer]
kakadu has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
kakadu has quit [Read error: Connection reset by peer]
Tuplanolla has joined #ocaml
kakadu has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
zebrag has quit [Read error: Connection reset by peer]
zebrag has joined #ocaml
bartholin has quit [Quit: Leaving]
mbuf has joined #ocaml
kakadu has quit [Read error: Connection reset by peer]
bjorkintosh has quit [Ping timeout: 250 seconds]
Haudegen has joined #ocaml
neiluj has quit [Quit: leaving]
<olle_>
"non-escaping variables" gives nothing on google. there's no such thing?
<olle_>
statically enforced no-escaping from scope
<olle_>
or statically enforced locality
mbuf has quit [Quit: Leaving]
<olle_>
is there a word?
narimiran has joined #ocaml
<steenuil>
sounds like you want linear types?
<companion_cube>
olle_: good luck with closures :p
<olle_>
steenuil: or maybe some kind of affinity...?
<steenuil>
possibly
<olle_>
linearity is too restrictive often
<olle_>
companion_cube: no closures, no closures
<olle_>
and no concurrency
<olle_>
I know my boundaries xD
<olle_>
well
<olle_>
you can just copy stuff forever, like in <lang that shouldn't be named>
<companion_cube>
no closures? sadface
<olle_>
:)
<olle_>
actually, when compiling to C, you can do anonymous functions easily if they do NOT capture scope
<olle_>
just render the (x) => x * 2 function somwehere, ___tmp___x123
<olle_>
with a cryptic name
<steenuil>
or you could have a language where you explicitly capture variables, I think there's a syntax for that in C++
<companion_cube>
yikes again
<olle_>
steenuil: php does this, which might be GOOD because there's no block scope!
<olle_>
long discussion about that on their internals
<olle_>
steenuil: yes, explicit capture would be to just add another argument to the generated function. pretty easy. surprisingly easy.
<olle_>
an automatic extra argument
<steenuil>
yeah that's the idea
<steenuil>
you can also implement proper closures like that in C, it's just a bit more work
<olle_>
yeah? didn't think that far
<olle_>
I'm more interested in the memory model. If a dev knows the scope/lifetime of a variable at time of writing, he/she should be able to use that fact as an optimization.
<dieggsy>
i'm looking to have separate executables
<dieggsy>
but i'm wondering if specifying 'modules' like that is telling it that every executable depends on every other file as a module
<dieggsy>
as opposed to a one to one correspondance
<companion_cube>
it's not a one to one correspondance
<dieggsy>
companion_cube: shoot. is there a way to define a library and multiple executables like this without having to repeat (executable ..) for every executable
<companion_cube>
I'm not sure, tbh
<companion_cube>
probably not in the same directory, but don't take my word for it
curtosis has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
<dieggsy>
meh, then i'll deal with the minor annoyance of it thinking it has to compile with all these modules
<dieggsy>
it results in the same binary anyway something something dead code elimination
<dieggsy>
...i think anyway
<dieggsy>
maybe i'll split it later on
<olle_>
companion_cube: It mentions GC runtime, but I would have to read more for the details. Pretty complex.
<olle_>
Like the interaction between the different features.
<dieggsy>
ah, i can put the library in a subdirectory. neat
cantstanya has quit [Remote host closed the connection]
cantstanya has joined #ocaml
landonf has quit [Excess Flood]
landonf has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
<companion_cube>
olle_: they removed the GC because Arc<> goes a long way
<companion_cube>
and no runtime
<olle_>
hm
<olle_>
ah ok, so it's only the cycles that are missing from Arc, then?
<olle_>
hm hm hm
<companion_cube>
yes, mostly (and even then you can use weak refs)
<companion_cube>
cycles wouldn't be handled well by the borrow checker anyway
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
<olle_>
yeah
curtosis has joined #ocaml
<olle_>
Question: Affine types would make it possible to create memory safe tight memory control, right? Use Obj.magic but wrap it in a module.
Haudegen has quit [Ping timeout: 248 seconds]
* olle_
zzz
curtosis has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]