andreas31 has quit [Remote host closed the connection]
andreas31 has joined #ocaml
mbuf has joined #ocaml
Serpent7776 has joined #ocaml
laokz has joined #ocaml
wonko7 has joined #ocaml
shawnw has joined #ocaml
mxns has joined #ocaml
<reynir>
I seem to have hit an infinite loop in my build :o
<reynir>
Oh, no, it just took super long
mxns has quit [Ping timeout: 256 seconds]
kini has quit [Ping timeout: 268 seconds]
<reynir>
Ahh nevermind, it's because dune was scanning ~6000 files of 20 GB of unrelated data
mxns has joined #ocaml
wonko7 has quit [Ping timeout: 245 seconds]
mxns has quit [Ping timeout: 268 seconds]
brj has quit [Ping timeout: 256 seconds]
<zozozo>
reynir I think there is an option for dune to ignore/not scan some directories, that might help with that
brj has joined #ocaml
<reynir>
Yea. In my case I could just remove the files :)
wonko7 has joined #ocaml
<vsiles>
zozozo: yes, you can put `(data_only_dirs foo)` in a dune file to ignore the subdir `foo`
Haudegen has joined #ocaml
webshinra has quit [Read error: Connection reset by peer]
webshinra has joined #ocaml
hosewiejacke has joined #ocaml
borne has joined #ocaml
<d_bot_>
<joris> @Drup hi, do you know how complete the js parser/AST in jsoo is ? i was wondering if it would make sense to wrap it in ppx to write some inline js with tyxml and stuff
<d_bot_>
<Drup> I think it's reasonably complete
<d_bot_>
<Drup> it's supposed to be used for global dead code elim, including vendored JS libraries
<d_bot_>
<joris> might give it a try this evening
<d_bot_>
<Drup> (that being said, I'm not super convinced it's a good idea in general ...)
<d_bot_>
<Drup> (unless it's for the 1st of April, then it's a fantastic idea :D)
<d_bot_>
<joris> why not ?
<reynir>
Oh, I look forward to 1st of April code :D
<d_bot_>
<Drup> @joris in general, it's very brittle, and the association with the ocaml code is going to be difficult
<d_bot_>
<Drup> if you are using jsoo, you might as well compile the caml instead ...
webshinra has quit [Remote host closed the connection]
<d_bot_>
<joris> this would be mostly useful for static pages generations with a bit of script. In theory i agree with you, in practice i think it is still better than doing sprintf
webshinra has joined #ocaml
<d_bot_>
<Drup> You could still do it statically
bartholin has joined #ocaml
hosewiejacke has quit [Remote host closed the connection]
hosewiejacke has joined #ocaml
laokz has quit [Ping timeout: 245 seconds]
dhil has joined #ocaml
hosewiejacke has quit [Ping timeout: 268 seconds]
<d_bot_>
<Drup> (in fact, that's something that I've been wanting to do for a long time, allow to splice pieces of code statically without too much ceremony, as opposed to eliom which is .. a bit complicated)
<d_bot_>
<Drup> It seems to me that it's just "An ADT with some constructors, plus one module per constructor, and a function that evaluates the ADT by using the module for each constructor"
<d_bot_>
<Drup> If you want to avoid a centralized ADT definition that lists the cases, you could do that:
<d_bot_>
<Drup> ```ocaml
<d_bot_>
<Drup> type command = Command : {
<d_bot_>
<Drup> stuff ;
<d_bot_>
<Drup> arguments : 'a;
<d_bot_>
<Drup> execute : 'a -> unit;
<d_bot_>
<Drup> } -> command
<d_bot_>
<Drup> ```
<d_bot_>
<Christophe> sounds like first class functions or its defunctionalized version right ?
<d_bot_>
<Drup> Well, most design patterns are about struggling around the absence of either ADTs or first class functions 😄
noonien has quit [Ping timeout: 276 seconds]
nepascourir has joined #ocaml
nepascourir has quit [Remote host closed the connection]
nepascourir has joined #ocaml
<olle>
Hm
noonien has joined #ocaml
Ben15 has joined #ocaml
<olle>
`type command` does not really solve the issue of putting each command in a separate file
borne has quit [Ping timeout: 268 seconds]
<olle>
But I guess you can translate it to a module signature easily
<Armael>
to make things more concrete, it might be useful for you to implement a simple example scenario using the OOP pattern, and ask ocaml-savvy people how they would translate it
laokz has joined #ocaml
<olle>
I mention two use-cases in the link, first being database migrations. Imagine a folder where each file upgrades the database, and the files are named in version of the database.
smerdyakov has quit [Ping timeout: 264 seconds]
<Armael>
mentionning use cases is good, but concrete code is better
<Armael>
otherwise it's easy for people to talk through each other
<olle>
It's a bit paradoxical, the situation. In FP it's very easy to pass around "execution units" with lambdas, but when you need something bigger, like passing around an execution unit in the form of a module, there's no obvious idiomatic way. At least not what I've seen yet. :)
<Drup>
there is always first class modules, but you can also just pass ... a bigger function
<d_bot_>
<Christophe> Olle: do you see putting each command as a desirable thing? I believe that in the specification of the design pattern it's because Java imposes one class per file
<Drup>
In any case, my scheme above specifically address having each specific command in different files. The types `command` is analogous to the main `Command` class, and the rest can be in their own files
<Drup>
(also, I fail to see how this pattern is very benefitial to db migrations, and the php framework is not very enlightening except "that's how we do it")
<olle>
Christophe, yep, separate files are for me very wanted, in an enterprise setting (10+ year projects, merge conflicts, devs from multiple countries and generations).
<olle>
Drup: Wouldn't you require the `type command` definition in each command module...?
<Drup>
no, you can just create elements of that type
<Drup>
we don't
<Drup>
really need inheritance here, just ... command builders
<d_bot_>
<Deadrat> and then run them from last applied one
<hackhorn>
hi
<d_bot_>
<Deadrat> no need to use separate file or module for one migration
<d_bot_>
<Deadrat> i would personally tie migrations to releases
<d_bot_>
<Deadrat> that involve them
hackhorn is now known as hackinghorn
<olle>
I explained above that file separation is beneficial in enterprise settings
<olle>
YMMV :)
<d_bot_>
<Deadrat> how this
<d_bot_>
<Deadrat> > separate files are for me very wanted, in an enterprise setting (10+ year projects, merge conflicts, devs from multiple countries and generations).
<d_bot_>
<Deadrat> relate to this
<d_bot_>
<Deadrat> > file separation is beneficial in enterprise settings
nepascourir has quit [Ping timeout: 265 seconds]
<olle>
?
mxns has joined #ocaml
<d_bot_>
<Deadrat> i mean
<d_bot_>
<Deadrat> how project longetivity
<d_bot_>
<Deadrat> amount of devs
<d_bot_>
<Deadrat> is
<d_bot_>
<Deadrat> related to need to put each in migration in separate file
<d_bot_>
<Deadrat> when you can put them per app version that needs them
mxns has quit [Ping timeout: 265 seconds]
<olle>
scalability, I guess
<olle>
Drup, mind if I copy-paste your suggestions to reddit thread?
<d_bot_>
<Deadrat> its either you need it because you know why you need it or you are just want to write ~~fortran~~ old code in new languages, that have different idioms for this stuff
narimiran has quit [Ping timeout: 268 seconds]
<d_bot_>
<Deadrat> all "enterprise" java/csharp/php/nodejs projects usually transform into complete clusterf*ck in a few years of maintenance esp. with pattern/architecture astronauts, but maybe that's the project's i've seen
<olle>
Yes, big projects are hard :)
<Drup>
olle: go on, go on
<olle>
Drup: Thanks!
<d_bot_>
<Drup> @Deadrat I think you are partially missing the point. Having the *option* for separating the various bits into separate files without needing a centralized points of coordination that needs to change every time the notion of command is extended is very desirable for big distributed open source projects in general. An example of such project is mirage. 🙂
<d_bot_>
<Drup> (Not saying if it's really all that relevant for olle, but this kind of property *is* ocasionally essential)
Haudegen has quit [Quit: Bin weg.]
<olle>
" C# is Microsoft Research's 20-year-long con to turn Java programmers into OCaml programmers so slowly that they don't notice. "
<olle>
Hehe
<olle>
"In a few years, C# 20.0 will have only one release note: Changed the name from C# to F# "
mxns has joined #ocaml
<d_bot_>
<Drup> I recently discovered next Java version will have sealed classes, which is Scala's implementation of ADTs
<d_bot_>
<Drup> only missing pattern matching next
<olle>
PHP already has pattern matching in latest version
<olle>
It's all coming together :D
<olle>
Only 40+ years late to reach mainstream. ^^
<olle>
Or more?
<olle>
Command object pattern can also be used to carry side-effects around, making the code more pure.
<olle>
As an alternative to monadic style. Not saying it's better. Just an alternative.
mxns has quit [Ping timeout: 256 seconds]
mxns has joined #ocaml
borne has joined #ocaml
hosewiejacke has quit [Ping timeout: 245 seconds]
tryte_ has joined #ocaml
tryte has quit [Ping timeout: 268 seconds]
mxns has quit [Ping timeout: 260 seconds]
nepascourir has joined #ocaml
<d_bot_>
<froyo> olle, isn't OOP's command pattern just closures in our world?
<d_bot_>
<froyo> closures and hofs
mxns has joined #ocaml
<d_bot_>
<froyo> read up on the conversation more
<d_bot_>
<froyo> i see how that concluded
mxns has quit [Ping timeout: 245 seconds]
<olle>
froyo, yep yep :)
<d_bot_>
<joris> i want to do it with minimal effort. That's my way of life 😄
<d_bot_>
<froyo> luckily ocaml natively supports classes, why not just mechanically translate your biz logic?
<olle>
1. Not sure if needed. 2. I'd end up with both modules and classes, since all files are also modules.
webshinra has quit [Remote host closed the connection]
webshinra has joined #ocaml
shawnw has quit [Ping timeout: 256 seconds]
<companion_cube>
Drup: java is already getting some form of pattern matching
<companion_cube>
in preview in java 14 or 15 I think
Haudegen has joined #ocaml
<d_bot_>
<Anurag> it's in Java 16. I believe it's limited to pattern matching for the instanceof operator in Java.
<companion_cube>
yes, but with sealed classes you get exhaustiveness checks
<companion_cube>
kotlin is definitely putting pressure on Java to catch up
mxns has joined #ocaml
mxns has quit [Ping timeout: 256 seconds]
<olle>
"catch up" to the OOP+FP merge :D
<olle>
What will happen after all languages support both OOP and FP idioms?
borne has quit [Quit: WeeChat 3.1]
<d_bot_>
<Deadrat> every language will become scala/ocaml XD
borne has joined #ocaml
nepascourir has quit [Quit: Leaving]
<d_bot_>
<EduardoRFS> hopefuly ocaml not scala
<d_bot_>
<EduardoRFS> because I want to be able to compile my code more than once a day
<qwr>
interesting thing is that interfaces/type classes/modules have a lot of cross section
<companion_cube>
maybe OCaml's object system is a warning against structural typing :p
<d_bot_>
<EduardoRFS> qwr: that's true, especially with FCM you can do really cool fast and nice OOP in OCaml
mxns has joined #ocaml
laokz has joined #ocaml
zebrag has joined #ocaml
laokz has quit [Client Quit]
<d_bot_>
<froyo> qwr, I think, more accurately perhaps, that they happen to overlap too much in Java's case.. with the overloaded concept of a class.
mxns has quit [Ping timeout: 272 seconds]
webshinra has quit [Remote host closed the connection]
<d_bot_>
<froyo> object, namespace, interface, compilation unit, data structure...
<d_bot_>
<froyo> oh nvm.. *type* classes
<d_bot_>
<froyo> glanced over that
<d_bot_>
<EduardoRFS> same lol
webshinra has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
narimiran has joined #ocaml
hosewiejacke has joined #ocaml
<d_bot_>
<froyo> olle, well yeah.. But have people already suggested modules and you have an issue with those somehow? I don't really get the "structurally typed" complaint.. I think elaborating on that could help!
<d_bot_>
<froyo> Perhaps putting each command in a separate file with a module that implements a common signature, then passing them as either first-class values or as a functor instantiation would be more idiomatic. Engines could even be passed to a functor to produce an abstraction over your module collection.
<d_bot_>
<froyo> ```ocaml
<d_bot_>
<froyo> module type DataBase = sig ... end
<d_bot_>
<froyo> module type Engine = sig ... end
<d_bot_>
<froyo> module type Migration = sig ... end
<d_bot_>
<froyo> module type Driver
<d_bot_>
<froyo> = sig
<d_bot_>
<froyo> val migrations: (module Migration) list
<d_bot_>
<froyo> Really, nothing about the "command pattern" behaviours described online seems to be particularly hard to express in OCaml.
<olle>
froyo, about struct typed, I might want to enforce a difference on type level between db migration commands, and rest api commands, although both module sigs only require "execute" function.
<olle>
The difficulty is the enterprise setting, not the trivial proof-of-concept
hosewiejacke has quit [Ping timeout: 245 seconds]
webshinra has quit [Ping timeout: 264 seconds]
mxns has quit [Ping timeout: 260 seconds]
webshinra has joined #ocaml
mxns has joined #ocaml
<d_bot_>
<EduardoRFS> is the ocaml type system turing complete?
<companion_cube>
I don't think so, checking is definitely decidable
<Armael>
yes because of modules
<companion_cube>
?!
<companion_cube>
what's a type that can't be checked Armael ?
<d_bot_>
<EduardoRFS> checking is not decidable
<d_bot_>
<EduardoRFS> something regarding module type and the subtyping involved in them
<Armael>
well maybe I'm getting confused
<companion_cube>
inferene is obviously not decidable, but checking?