<Algebr>
Another peculiar oasis error. I have an executable and test section, the test being a usage of the executable. I have but one file called do_test.ml but oasis tels me "Ocamlbuild knows of no rules that apply to a target named tests/do_test.mly."
darkf has joined #ocaml
tmtwd has joined #ocaml
struktured has joined #ocaml
MercurialAlchemi has joined #ocaml
samrat has quit [Ping timeout: 260 seconds]
MercurialAlchemi has quit [Ping timeout: 240 seconds]
Bhavya has joined #ocaml
kdef has quit [Quit: Leaving]
tane has joined #ocaml
huza has joined #ocaml
AlexRussia has joined #ocaml
psy_ has quit [Quit: Leaving]
huza has quit [Quit: WeeChat 0.3.8]
psy_ has joined #ocaml
tane has quit [Quit: Verlassend]
sailorswift has joined #ocaml
Algebr has quit [Ping timeout: 264 seconds]
ggole has joined #ocaml
meteo has joined #ocaml
swgillespie has joined #ocaml
Haudegen has quit [Ping timeout: 256 seconds]
mcclurmc has joined #ocaml
tmtwd has quit [Ping timeout: 250 seconds]
martinium has joined #ocaml
Haudegen has joined #ocaml
sailorsw_ has joined #ocaml
sailorswift has quit [Ping timeout: 256 seconds]
sh0t has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tmtwd has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
grouzen has joined #ocaml
sh0t has quit [Ping timeout: 250 seconds]
TheLemonMan has joined #ocaml
TheLemonMan has joined #ocaml
TheLemonMan has quit [Changing host]
c74d has quit [Remote host closed the connection]
c74d has joined #ocaml
tmtwd has quit [Remote host closed the connection]
ely-se has joined #ocaml
tmtwd has joined #ocaml
octachron has joined #ocaml
tmtwd has quit [Remote host closed the connection]
toomuchtvrotsurb has joined #ocaml
<ely-se>
ooh I thought core was the standard library, but it isn't
toomuchtvrotsurb has quit [Remote host closed the connection]
toomuchtvrotsurb has joined #ocaml
<ely-se>
The API documentation is really cluttered though
zpe has joined #ocaml
ollehar has joined #ocaml
<companion_cube>
it's an alternative to the standard library
<companion_cube>
that is arguably more complete and consistent, but also heavier
Bhavya has quit [Ping timeout: 240 seconds]
kushal has joined #ocaml
yomimono has joined #ocaml
ollehar has quit [Ping timeout: 244 seconds]
domsj has joined #ocaml
<domsj>
Hi all, I have a question regarding Gc.finalise ... in the documentation there's a remark starting with
<domsj>
""Anything reachable from the closure of finalisation functions is considered reachable, so the following code will not work as expected""
<domsj>
I tried making a small example in utop which verifies that remark
<domsj>
but so far haven't been able too
<domsj>
can anybody shed some light on that?
<ely-se>
Is it more common to use CamelCase or Ugly_case for variant names?
<domsj>
or is the example there just bad and should it be ""let v = ... in Gc.finalise (fun x -> (* don't use v here, instead always x! *) ...) v ""
<domsj>
ely-se I think both are used in the ocaml community. If I'm not mistaken e.g. mirage has a coding style in which they prefer Ugly_case
<ely-se>
ok
<domsj>
not sure about what janestreet uses in core .. you could look that up too
<ely-se>
I'll check it out, thanks.
dsheets has joined #ocaml
ely-se has quit [Quit: leaving]
<adrien>
domsj: not sure about the example but basically, it's all about the GC not freeing things that are still visible and could therefore be still in use
johnelse_ is now known as johnelse
ely-se has joined #ocaml
yomimono has quit [Ping timeout: 244 seconds]
yomimono has joined #ocaml
<companion_cube>
so it looks like colored messages in OCaml will be merged soon
Bhavya has joined #ocaml
ely-se has quit [Quit: leaving]
whirm has joined #ocaml
EuS8yeiF has joined #ocaml
ggole has quit [Ping timeout: 250 seconds]
Bhavya has quit [Quit: Quit the channel]
toomuchtvrotsurb has quit [Remote host closed the connection]
toomuchtvrotsurb has joined #ocaml
ely-se has joined #ocaml
theblatt1 has joined #ocaml
w0rp_ has joined #ocaml
w0rp has quit [Ping timeout: 240 seconds]
theblatte has quit [Ping timeout: 240 seconds]
Pepe_ has quit [Ping timeout: 240 seconds]
Pepe__ has joined #ocaml
domsj has quit [Remote host closed the connection]
Bhavya has joined #ocaml
Haudegen has quit [Ping timeout: 250 seconds]
obadz has quit [Quit: leaving]
sailorsw_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
obadz has joined #ocaml
Haudegen has joined #ocaml
igoroliveira has joined #ocaml
toomuchtvrotsurb has quit [Remote host closed the connection]
<companion_cube>
basically, here, it would be let sum f s = Sequence.of_str s |> Sequence.map f |> Sequence.fold (+) 0 ;;
Haudegen has joined #ocaml
yomimono has quit [Ping timeout: 272 seconds]
<sqweek>
cool, thanks
Pepe__ is now known as Pepe_
nullcatxxx_ has joined #ocaml
<sqweek>
is there standard polymorphic arithmetic functions or do i have to write my own?
<companion_cube>
there is no overloading, therefore arith functions come in int flavour, float flavour, etc.
<ely-se>
I like +. being separate, as floating point addition isn't associative :)
cdidd has quit [Ping timeout: 244 seconds]
<sqweek>
there is no overloading but fun 'a -> 'a that does the right thing for ints/floats should be possible?
<sqweek>
'a -> 'a -> 'a i mean
<thizanne>
but then you lose the whole point of a type system
<companion_cube>
sqweek: sadly not, it's not possible, as it breaks type inference
<companion_cube>
if modular implicits are merged, some day, then it will be possible
<sqweek>
fair enough
<flux>
sqweek, if you have a function 'a -> 'a, you can then use it for anything
<flux>
open_in "hello" + open_in "hallo"
<flux>
:)
<sqweek>
one function to rule them all :D
<flux>
while I can say it's not too bad that there is + and +. separately.. I still fail at it, often, when I start to write float-happy code.
<flux>
given that there is not going to be any implicit casting between ints and floats, I think it's prefectly OK to use + for both ints and floats.
<EuS8yeiF>
Is there a module with + for floats though? So I can open it locally and not bother typing dots.
<flux>
and of course, ints and floats are a little issue: but let's add (u)int(6|16|32|64) and vectors and we're running out of operators ;)
<flux>
eus8yeif, sure, I think for example Batteries comes with one
<flux>
and converting ints to floats has the 'float' function, if float_of_int seems too long.
tmtwd has joined #ocaml
cdidd has joined #ocaml
EuS8yeiF has quit [Ping timeout: 244 seconds]
ollehar has joined #ocaml
tennix has quit [Ping timeout: 246 seconds]
Bhavya has quit [Quit: Quit the channel]
cdidd has quit [Client Quit]
cdidd has joined #ocaml
<ely-se>
how does F# solve this problem?
<flux>
maybe it supports overloading.
<companion_cube>
F# is more object oriented, so maybe it uses objects
<companion_cube>
the clean solution in OCaml really is modular implicits
rand000 has quit [Quit: leaving]
<octachron>
F# has operator overloading for "statically resolved type parameters"
Haudegen has quit [Ping timeout: 244 seconds]
<flux>
so such functions are not first class citizens?
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tmtwd has quit [Ping timeout: 260 seconds]
<octachron>
As far as I understand, it only works with operators and it requires a new kind of types corresponding to types that can be fully resolved at compile time
Nahra has quit [Remote host closed the connection]
<ollehar>
what do you think: reference counting vs garbage collecting?
<ely-se>
reference counting is a form of garbage collection
<ely-se>
and in what context? they have different use cases
<ely-se>
(assumnig you meant tracing garbage collection)
<companion_cube>
ollehar: garbage collecting \o/
<companion_cube>
or safe manual handling à la rust
<ollehar>
for LLVM backend for PHP
<ollehar>
hm hm
<companion_cube>
hmmmmm
<ely-se>
you need refcounting if you want PHP programs to behave consistently with the official implementation
<companion_cube>
for php, it sounds difficult to make something sane anyway
<sqweek>
|> just blew my mind. thanks for the example companion_cube :)
<ollehar>
ely-se: but this is an implementation detail?
<ely-se>
PHP programs depend on destructors being called when the last reference goes away, e.g. out of scope
<ely-se>
it's not an implementatino detail
<ollehar>
that's true.
<companion_cube>
sqweek: yeah, |> is very very nice for some functions
<ely-se>
in "function f() { $x = new A(); }; f();" it is guaranteed that the destructor of $x is called before f returns
<companion_cube>
ely-se: does it handle ref loops?
<ely-se>
I think it doesn't.
<flux>
it's php, of course it doesn't :-P *badamtish*
<flux>
it does have weak references, though
<companion_cube>
maybe it wouldn't break the semantics to handle refcount loops properly
<companion_cube>
it would even un-break it
<sqweek>
companion_cube: i'm a huge sh fan so |> makes me feel right at home
<companion_cube>
now careful what you say! :p
<ely-se>
Languages which lack |> are instantly inferior.
<ely-se>
Haskell got it in its standard library lately
<ely-se>
\o/
kushal has quit [Remote host closed the connection]
Haudegen has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
zpe_ has joined #ocaml
<ollehar>
could LLVM handle the reflection in PHP? get_class etc. reading about rtti...
<ollehar>
guess you would just add that information for each object :P
<flux>
I think ollehar's approach just disallows such constructs?
<ely-se>
LLVM deals only with low-level C-like operations
<flux>
you can of course add your own meta data.
<ollehar>
ely-se: what is that, even? haha. yes, I'm working on a subset of php.
<companion_cube>
I'm surprised you are brave enough to even consider writing a php compiler
<ely-se>
ollehar: get_defined_vars() returns an array of variables in scope at the callsite
<ely-se>
the problem is that you can pass it around and it works that way
<ollehar>
yep hm... but in my case, $f would be a string, so you can't call it. but sure, you could still pass a lambda to do the same.
<ely-se>
I tend to call this "pointlessly dynamic"; a feature you never use but makes it impossible to optimize code without changing semantics.
<ollehar>
companion_cube: well, the linter is the purpose, really. I just want to see how fast I can make the first benchmark from benchmarkgames using PHP. or, how much you would have to strip to make a LLVM backend reasonable. lot of things to find out, I guess.
<ely-se>
there are JIT compilers for PHP already. you can look at them
<ely-se>
e.g. HHVM
<companion_cube>
good luck.
<ollehar>
ely-se: yeah, I know, I'm using their code-base ^^.
ely-se has quit [Quit: leaving]
<ollehar>
flux: adding meta-data would be an approach, yes. but java must do that to, to use "instanceof" (or "typeof", don't remember)?
<flux>
and c++ ;)
<ollehar>
right.
grouzen has quit [Ping timeout: 264 seconds]
zpe_ has joined #ocaml
<ollehar>
(btw, this is not a JIT-compiler)
zpe has quit [Ping timeout: 252 seconds]
<ollehar>
(and also, a fully type-inferred subset of php can't be harder to compile than java.)
ggole has joined #ocaml
<flux>
well, you don't need to infer anything in Java.
<ollehar>
flux: that's true. but in PHP, you only have to infer numbers, bool, string and arrays. objects can be type hinted.
<companion_cube>
flux: you have to infer some basic things
<companion_cube>
the diamond operators, the types of local classes/objects
<companion_cube>
it's simple inference, indeed, but inference nonetheless
tennix has joined #ocaml
tennix has joined #ocaml
ely-se has joined #ocaml
zpe_ has quit [Read error: Connection reset by peer]
<ely-se>
I see Flow has a module for each AST node type
<Drup>
it would be better with inline records, clearly
<Drup>
companion_cube: in this case, it doesn't matter, it's only types
<companion_cube>
but it forces the repetition of module types everywhere
<Drup>
companion_cube: no it doesn't
<companion_cube>
honestly I'd probably just write a record type for each variant
<ggole>
They do have variants for statement, expression, etc
<Drup>
companion_cube: look closer, no repeition
<Drup>
ely-se: the reason I guess is : they wanted records instead of tuples
<companion_cube>
I mean every module has its signature explicit
<ggole>
That look like | Block of Block.t | Expression of Expression.t
<Drup>
and they found that "Foo.Bar.t" was better than "foo_bar"
<ggole>
etc
<ely-se>
can't you say Foo of { x : int; y : float } ?
<ggole>
Not until 4.03
<Drup>
ely-se: in the next version of ocaml, yeah, you can
<ely-se>
ok
<Drup>
companion_cube: "module rec S : sig ... end = S"
<Drup>
it works if S is only types
<companion_cube>
hmmm
<Drup>
no repetition
<companion_cube>
weird
<Drup>
it's a frequent pattern
<Drup>
so no, no repetition
<companion_cube>
"it's a frequent pattern" first time I see it
<ggole>
I guess the advantage of the modules over records is that the namespacing
<Drup>
I have seen it several time when recursive modules come up
<Drup>
It's basically the common answer to "I want X and a type to recursive" with X ∈ { class type, signature, ... }
<Drup>
+be
<ggole>
Arguably with first class modules, module type rec should work with type
<Drup>
It's not very elegant, but that's a rather reasonable use case
<Drup>
ggole: module type rec should really exist
<Drup>
you can emulate it, but it's annoying and non-intuitive
<ggole>
eg type t = <mentions FOO> and module type FOO = <mentions t>
<companion_cube>
instead, could you do like module Function = struct type 'a t = { ret : 'a; args : 'a list } end
<companion_cube>
type t = .... | Function of t Function.t | ...
<ggole>
Or module type rec Foo = ... and t = ...
<companion_cube>
tie the knot by hand?
<Drup>
companion_cube: and how is that better ?
<companion_cube>
well, you don't have to write a long list of mutually recursive modules
<companion_cube>
I find this very very ugly, sorry for not sharing all of your tastes
<Drup>
companion_cube: no, you just have to duplicate all your declaration ...
<companion_cube>
?
<Drup>
type t twice
<ggole>
Introducing a useless type parameter is also pretty ugly
<Drup>
ggole: it can be useful, at times
<ollehar>
hack does not do it like that, but all their records is { f_params = ...; f_ret = ... etc }
lordkryss has joined #ocaml
<ggole>
Sure, but annoying when you're doing it just to work around limitations of the type system (or syntax)
<ollehar>
in the ast
<Drup>
I mean, tying the knot by hand can be very useful some time, but as a substitute for the other solution, it's quite bad
<Drup>
companion_cube: you trade a long list of modules for a long list of types, the syntactic overhead is not much shorter, so, *shrug*
<companion_cube>
well, at least it doesn't involve module rec
<Drup>
module rec is fine for pure signatures
ely-se has quit [Quit: leaving]
<companion_cube>
anyway, I would rather go with regular records that each have a different prefix
<Drup>
it's when there are runtime values that it's really blearg
Haudegen has quit [Ping timeout: 250 seconds]
<Drup>
companion_cube: so, you prefer to encode your hierarchy in foo_bar than use the module system, which handles that properly ?
tmtwd has joined #ocaml
jonludlam has quit [Remote host closed the connection]
<Drup>
I do agree it's not fabulous, but it's really not so bad, especially considering the other solutions ;)
<companion_cube>
I prefer to have inline records
AltGr has left #ocaml [#ocaml]
<ggole>
You can't pass around an inline record though.
<Drup>
ggole: still a bit annoyed they droped that feature
<ggole>
Yeah, it seemed like it would be just what you want every now and then
TheLemonMan has left #ocaml [#ocaml]
<flux>
maybe later? no?
grouzen has joined #ocaml
<ggole>
Though I can understand the argument that it was additional complexity for a small gain.
<Drup>
ggole: the main argument was "we can't figure out how to name the type, so we just drop the feature"
<companion_cube>
someone told me that the modular implicits branch added a feature compared to the original paper
<companion_cube>
and this is why its soundness is questionable :/
<flux>
companion_cube, which feature?
Haudegen has joined #ocaml
tennix has quit [Ping timeout: 264 seconds]
<companion_cube>
having implicit module arguments in any position, not only prenex
kiwnix has quit [Ping timeout: 246 seconds]
kakadu has joined #ocaml
ely-se has joined #ocaml
ely-se has quit [Quit: leaving]
badkins has joined #ocaml
tennix has joined #ocaml
tennix has quit [Changing host]
tennix has joined #ocaml
ely-se has joined #ocaml
samrat has joined #ocaml
BitPuffin has joined #ocaml
tennix has quit [Ping timeout: 250 seconds]
tennix has joined #ocaml
samrat has quit [Ping timeout: 265 seconds]
marsam has joined #ocaml
marsam has quit [Remote host closed the connection]
struktured has quit [Ping timeout: 264 seconds]
marsam has joined #ocaml
tennix has quit [Ping timeout: 250 seconds]
kushal has quit [Quit: Leaving]
samrat has joined #ocaml
ely-se has quit [Quit: leaving]
mcclurmc has joined #ocaml
tennix has joined #ocaml
tennix has quit [Ping timeout: 260 seconds]
tennix has joined #ocaml
tennix has joined #ocaml
testo has quit [Quit: Page closed]
jonludlam has joined #ocaml
kushal has joined #ocaml
tennix has quit [Ping timeout: 246 seconds]
MercurialAlchemi has joined #ocaml
tennix has joined #ocaml
tennix has quit [Ping timeout: 252 seconds]
nullcatx_ has joined #ocaml
nullcatxxx_ has quit [Ping timeout: 264 seconds]
tennix has joined #ocaml
jeffmo has joined #ocaml
tennix has quit [Ping timeout: 240 seconds]
jonludlam has quit [Ping timeout: 264 seconds]
tennix has joined #ocaml
ely-se has joined #ocaml
swgillespie has joined #ocaml
tennix has quit [Ping timeout: 272 seconds]
cross has joined #ocaml
tennix has joined #ocaml
tennix has quit [Changing host]
tennix has joined #ocaml
badkins has quit []
tennix has quit [Ping timeout: 255 seconds]
tennix has joined #ocaml
tennix has quit [Ping timeout: 255 seconds]
nullcatx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tennix has joined #ocaml
nullcatxxx_ has joined #ocaml
MrScout has joined #ocaml
domsj has quit [Ping timeout: 256 seconds]
octachron has quit [Ping timeout: 255 seconds]
marsam has quit [Remote host closed the connection]
marsam has joined #ocaml
<ely-se>
If I have a concrete type in an mli file, do I have to repeat it in the ml file?
<rks`>
yes.
<ely-se>
:(
<dsheets>
ely-se, you could make an mli-only module for your types and then you only have to say the defn once
toomuchtvrotsurb has joined #ocaml
jwatzman|work has joined #ocaml
kolko has quit [Ping timeout: 272 seconds]
kolko has joined #ocaml
tennix has quit [Ping timeout: 260 seconds]
grouzen has quit [Ping timeout: 240 seconds]
tennix has joined #ocaml
tennix has joined #ocaml
native_killer has joined #ocaml
<native_killer>
i want to ['1]
<native_killer>
oops
<native_killer>
i have ['1';'2';'3'] i want to convert it to 123. what will be the easy way to do this
jonludlam has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<flux>
first, you make a string out of each of them with String.make 1
<flux>
then you concate said strings
<flux>
^ the easy way :)
<native_killer>
ahh okay, thanks
tennix has quit [Ping timeout: 250 seconds]
samrat has quit [Ping timeout: 244 seconds]
slash^ has joined #ocaml
systmkor has joined #ocaml
MrScout_ has joined #ocaml
<dsheets>
make a bytes of the length of the list then iter the list and set the chars of the bytes
<flux>
yes, that's the efficient way :)
badkins has joined #ocaml
tennix has joined #ocaml
tennix has joined #ocaml
MrScout_ has quit [Read error: Connection reset by peer]
MrScout__ has joined #ocaml
<Drup>
use BatString.implode
<Drup>
the "it's already written why do you keep fucking NIHing it ?"
<Drup>
way
MrScout has quit [Ping timeout: 246 seconds]
<Drup>
( companion_cube : it's not in CC apparently)
<ggole>
Because tiny stdlib
ygrek has joined #ocaml
tennix has quit [Ping timeout: 246 seconds]
ygrek_ has joined #ocaml
jonludlam has quit [Ping timeout: 252 seconds]
<ely-se>
Why do I explicitly have to name the arguments to List.fold?
<ely-se>
For List.map it's optional.
<flux>
in fact, this is probably the easiest non-library solution, but also the most inefficient ;) String.init (List.length a) (List.nth a). though it does look a bit elegant..
ygrek has quit [Ping timeout: 264 seconds]
tennix has joined #ocaml
tennix has quit [Changing host]
tennix has joined #ocaml
samrat has joined #ocaml
<Drup>
flux: I do love an widly inefficient one liner, but only when it's in haskell.
tennix has quit [Ping timeout: 264 seconds]
octachron has joined #ocaml
tennix has joined #ocaml
grouzen has joined #ocaml
pyon has quit [Ping timeout: 246 seconds]
tennix has quit [Ping timeout: 244 seconds]
sh0t has joined #ocaml
pyon has joined #ocaml
tennix has joined #ocaml
ggole has quit [Ping timeout: 264 seconds]
ely-se has quit [Quit: Leaving...]
tennix has quit [Ping timeout: 246 seconds]
<MercurialAlchemi>
Drup: Perl one liners are more fun
tennix has joined #ocaml
tennix has quit [Ping timeout: 265 seconds]
dsheets has quit [Ping timeout: 252 seconds]
badkins has quit []
badkins has joined #ocaml
lobo has joined #ocaml
darkf has quit [Quit: Leaving]
jonludlam has joined #ocaml
MrScout__ has quit [Remote host closed the connection]
kakadu has quit [Quit: Page closed]
native_killer has quit [Read error: Connection reset by peer]
jao has joined #ocaml
ely-se has joined #ocaml
ely-se has quit [Client Quit]
<companion_cube>
Drup: what's not in containers?
MrScout_ has joined #ocaml
BitPuffin has quit [Ping timeout: 246 seconds]
yomimono has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
AlexRussia has quit [Read error: Connection reset by peer]
ghulette has joined #ocaml
ghulette has quit [Client Quit]
kushal has quit [Quit: Leaving]
marsam has quit [Ping timeout: 244 seconds]
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
toomuchtvrotsurb has quit [Remote host closed the connection]
jeffmo has quit [Read error: Connection reset by peer]
<zozozo>
ely-se: it seems pretty nice already, what more would you like ?
<ely-se>
I don't like that it takes so many lines and that the arguments are named, but I can't figure out another way to write it.
<zozozo>
you would always define the function separately, with an appropriate name, and then the fold only takes about one line
xificurC has quit [Remote host closed the connection]
<zozozo>
as for the naming of arguments, I don't know Core enough to give insights
<ollehar>
ely-se: what's vlinder? no readme?
<ely-se>
ollehar: Compiler for a programming language I'm working on.
<ely-se>
zozozo: lemme try that. :p
toomuchtvrotsurb has joined #ocaml
<ollehar>
ely-se: yes, I guessed that. :)
rand000 has joined #ocaml
<Drup>
companion_cube: CCString.implode
<Drup>
(and explode)
<Drup>
(which are transformation to/of char list)
<ely-se>
ollehar: it generates code that can be typechecked by Flow.
nullcatxxx_ has joined #ocaml
<ollehar>
ah ok
<ollehar>
ely-se: what's the use-case?
<ely-se>
zozozo: yes, much better now. thanks!
<ely-se>
ollehar: anything that runs in web browsers, unless paradigms other than the functional or imperative ones are more appropriate
<ollehar>
ely-se: so it spits out javascript?
<ely-se>
yes!
Algebr has joined #ocaml
<ely-se>
Well, it spits out a JavaScript AST which is then read by the escodegen Node.js library which turns it into JavaScript code.
<ely-se>
that's done in codegen.ml
<ollehar>
ely-se: couldn't you take the parser from Flow and then modify the lexer for your needs?
<ollehar>
or, hm, take the ast from flow and modify the parser/lexer. :P
<ely-se>
I'd have to learn about the inner workings of Flow
<ely-se>
which probably change a lot from time to time.
<Drup>
I doubt the AST changes that often
<ely-se>
I also don't see the benefit.
<ollehar>
if you want a syntax to compile to javascript/flow ast, then that would be all you needed. :) I think.
<ollehar>
no idea what parts they change in the code-base, but they've said it changes a lot, I've heard.
<Drup>
ollehar: there is no code emiter in flow, it's just a linter
samrat has quit [Ping timeout: 252 seconds]
<Drup>
emiting Flow's ast doesn't help you printing javascript
<ely-se>
Also, it'd be more than the lexer and parser.
<Drup>
ely-se: using flow directly would be much faster, though, but that's another question
<ely-se>
I have strict lexical scoping, support for contract programming, strict type checks for if conditions, etc
<ollehar>
ok cool
<_obad_>
anyone going to vancouver next month for ICFP etc.?
swgillespie has joined #ocaml
* Drup
raises hand.
<_obad_>
which days are you attending? I picked thursday & friday
<Drup>
all of it
<Drup>
and I arrive 2 days before, to do tourism
<_obad_>
great maybe we'll meet there
<Drup>
(If someone is interested in being my guide ... :D)
kakadu has joined #ocaml
<_obad_>
eh I'm not from van so I can't really help! but van island is beautiful.
<_obad_>
and I'm sure whatever is left of mainland BC after the forest fires is beautiful too
whirm has quit [Quit: WeeChat 1.2]
marsam has joined #ocaml
claudiuc has joined #ocaml
dsheets has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<ollehar>
but, then rewrite the parser/lexer of flow to your own syntax s and add a codegen module. sorry if I'm banging on your idea, here. :P
<ollehar>
maybe flow is not such an important part, just to emit javascript.
<ollehar>
ach.
pyx has joined #ocaml
pyx is now known as Guest529
jabesed has joined #ocaml
Guest529 has quit [Client Quit]
pyx_ has joined #ocaml
pyx_ has quit [Client Quit]
tennix has joined #ocaml
<ely-se>
flow only typechecks. it doesn't do anything else.
<ely-se>
It doesn't generate any code.
<smondet>
Is there a way to know, at which commit in ocaml/opam-repository is https://opam.ocaml.org ? or when was the latest sync?
tennix has quit [Ping timeout: 272 seconds]
w0rp_ is now known as w0rp
python4567 has joined #ocaml
<python4567>
hello
<python4567>
when I run let n = 10 in Printf.printf "%d" n ;; in a repl, it prints fine
<python4567>
but the same thing in a file, ocaml file -o ... fails because of typing error
<Drup>
what's the error ?
<python4567>
expression has type of ('a -> 'b, out_channel, unit, unit, unit, 'a->'b)
<python4567>
but an expression was expected of type (.... unit, unit, unit, unit)
<python4567>
only the last type 'a -> 'b mismatch
<flux>
your file has something else than that line as well, right?
<python4567>
hmm you think the type error propagated far from its origin ?
<python4567>
that would make sense...
MrScout_ has quit [Remote host closed the connection]
<python4567>
probably forgot a ;; somewhere
<flux>
yep, add a new line before that that has ;; and nothing else
<flux>
though you should perhaps know that 'real' ocaml programs don't need any ;;
pyx_ has joined #ocaml
<flux>
but personally I think it's fine to use when learning it, given how useful it's in the toplevel :)
<python4567>
;; fixed it
<python4567>
For a reason I thought it was a repl only token
MrScout has joined #ocaml
pyx_ has quit [Client Quit]
<Drup>
python4567: it pretty much is, but if you do "ocaml file ..", you are still evaluating in the repl
<Drup>
ocamlc and ocamlopt are the compilers
<flux>
however, the rule is: ocaml modules (in .ml-files) are sequences of phrases (1 or more). phrases are either a sequence of top-level statements (ie. open, let a = b, but NOT let a = b in) or a single expression. phrases are separated from each other with ;;.
<python4567>
Drup: sorry, I meant ocamlopt
<python4567>
in a Tupfile rule
<flux>
(top-level statements are called 'definitions' in the language specification)
BitPuffin|osx has joined #ocaml
<flux>
so following that rule, you can always just write the program as a single phrase, so as a sequence of top-level statements, and never need a ;;
<python4567>
sequencing them with `and` ?
<flux>
no, just plain put them one after each other
<flux>
let a = 42 let b = 55
<flux>
that's a sequence of two top-level statements (definitions)
<flux>
of course, often times you use newlines instead of spaces :)
_andre has quit [Quit: leaving]
<python4567>
oh, surprising
<flux>
for example, a complete ocaml program: open Printf (* bring in printf *) let main () = printf "hello world\n" (* kick off calling the main function *) let () = main ()
<mrvn>
flux: ;; is an interactove toplevel thing, not module.
<flux>
though I'm not 100% if it actually works that way ;)
<mrvn>
best top think of ";;" as a "go and evaluate my input now".
<mrvn>
"For compatibility with toplevel phrases (chapter 9), an optional ;; is allowed after each definition in a structure. The ;; has no semantic meaning."
<flux>
(it does)
<flux>
yet it's part of the accepted syntax
<flux>
so it totally works without toplevel
<mrvn>
but "no semantic meaning"
<mrvn>
What does "Also for compatibility, expr is allowed as a component of a structure, meaning let _ = expr, i.e. evaluate expr for its side-effects." refer to? # module M = struct let _ = 1 let b = 2 end;;
BitPuffin has joined #ocaml
<mrvn>
module M : sig val b : int end
<flux>
in any case, I referred to ("in .ml-files") to mean that they are not to be used in 'real' modules, but only when writing ml-files that implicitly becomes modules - even if then
<mrvn>
"In this case, the ;; of the previous component (if any) is not optional." works without just fine
<python4567>
mrvn: otherwise the repl would try to evaluate everything in one go after you typed it all ?
<mrvn>
python4567: otheriwse the repl would wait for more input forever
<flux>
mrvn, well, this works: module A = struct 42 let b = 42 end;;
<python4567>
most appriopriate user interface behavior
<python4567>
silence of the repl #thrill
<flux>
python4567, how otherwise it would know you're done?-)
<flux>
python4567, ie: let rec a () = b () (* hits enter *) - b is undefined
<flux>
but you might continue that with and b () = 42
<python4567>
in that case yes
<mrvn>
flux: but shouldn't according to the text in 6.11.2
<python4567>
but let x = 1 in RET <- incomplete grammar, wait
<flux>
python4567, another case: let doodidaa () = Printf.printf "Hello %s" (* hits enter *)
<flux>
so doodidaa () now returns a partially applied function
<python4567>
let x = 1 in x RET <- reduced, evaluate
<flux>
when you actually intended to add "world" to the next line
<python4567>
yeah
<python4567>
but I'm sure it's more intuitive that way
<python4567>
if I type something partially, I'll have a partial "object"
<flux>
but how often would you accidentally evaluate something you didn't mean to?
<mrvn>
python4567: In that case the grammar says there must still come some more input. Better example: let x = 1 <RET> ; 2
<flux>
or even: let x = 1 <RET> - 1
<flux>
the kind of whitespace isn't significant in ocaml :)
<mrvn>
But luckily there is ";;"
<python4567>
creative layout
<python4567>
you mentioned whitespace significance because of my nick ? :p
<flux>
python4567, maybe, maybe I didn't!
<mrvn>
one of the things that suck in python. You can't easily break long lines
<flux>
(no, but it did come to my mind after mentioning it ;-))
<python4567>
so much mystery
<ely-se>
so much misery
<python4567>
I'm a lisper at heart anyway, not a pythonista
<python4567>
even though I appreciate to social implication of canonical whitespace significant syntax
<python4567>
s/to/the
<python4567>
are you people using *ml for work ?
<ely-se>
NO
<python4567>
misery indeed
<python4567>
anyway, thanks for the help
<python4567>
see ya later combinator
python4567 has quit [Quit: leaving]
MercurialAlchemi has quit [Ping timeout: 244 seconds]
jonludlam has quit [Ping timeout: 265 seconds]
zpe has quit [Remote host closed the connection]
jonludlam has joined #ocaml
<ely-se>
I prefer brushinators over combinators
<ely-se>
combs suck
<octachron>
mrvn, the manual wording could be improved. 6.11.2 is trying to say that let def = ... ;; expr is semantically equivalent to let def = ... let _ = expr
<octachron>
and the former is allowed for compatibility with the toplevel
sp0on has joined #ocaml
<mrvn>
octachron: ahh, that makes more sense
MrScout has quit [Remote host closed the connection]
jabesed has quit [Ping timeout: 246 seconds]
MrScout has joined #ocaml
<octachron>
mrvn, unfortunately this section of the manual often devolves into describing in words the BNF grammar for people who already understood the BNF grammar
MrScout has quit [Remote host closed the connection]
MrScout has joined #ocaml
swgillespie has joined #ocaml
MrScout_ has joined #ocaml
MrScout has quit [Remote host closed the connection]
rpg has joined #ocaml
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
badkins has quit []
<rpg>
The Ocaml page suggests installing the compiler through opam, and then using opam switch to get the compiler. But whenever I try opam switch I get an error telling me I should switch, but no guidance about what to switch *to*. How should I get an opam compiler?
* rpg
is trying to install on OS X, but the Mac Ports packages seem messed up.
yomimono has quit [Ping timeout: 252 seconds]
swgillespie has quit [Ping timeout: 250 seconds]
<octachron>
rpg, have you tried opam switch 4.02.3 ? (after an "opam init; opam update")
<rpg>
octachron: Thanks!
<rpg>
building now...
jonludlam has quit [Ping timeout: 240 seconds]
<rpg>
Yes, that did it!
<rpg>
Sorry to be so dense, but the Ocaml page doesn't really tell you how to figure out what values work for "ocaml switch"
<octachron>
Not a problem. Which page were you looking at?
tmtwd has quit [Ping timeout: 260 seconds]
ceryo has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
lobo has quit [Quit: leaving]
zpe has joined #ocaml
sh0t has quit [Remote host closed the connection]
zpe has quit [Ping timeout: 240 seconds]
rpg has quit [Quit: rpg]
rpg has joined #ocaml
MrScout_ has quit [Remote host closed the connection]
tennix has joined #ocaml
jabesed has joined #ocaml
tennix has quit [Ping timeout: 240 seconds]
QuanticPotato has joined #ocaml
ollehar1 has joined #ocaml
ollehar has quit [Ping timeout: 252 seconds]
octachron has quit [Quit: Leaving]
shinnya has joined #ocaml
QuanticPotato has quit [Ping timeout: 240 seconds]
rpg has quit [Quit: rpg]
grouzen has quit [Ping timeout: 246 seconds]
swgillespie has joined #ocaml
ely-se has quit [Quit: Leaving...]
tmtwd has joined #ocaml
marsam has quit [Read error: Connection reset by peer]
mcclurmc_ has joined #ocaml
kakadu has quit [Remote host closed the connection]
mcclurmc has quit [Ping timeout: 265 seconds]
meteo has quit [Ping timeout: 246 seconds]
keen__________35 has quit [Ping timeout: 250 seconds]