Simn has quit [Read error: Connection reset by peer]
avsm has quit [Ping timeout: 240 seconds]
hyperboreean has quit [Ping timeout: 240 seconds]
hyperboreean has joined #ocaml
<mrvn>
Jippey. I just figured out that I don't need an array the size of the width of the universe but only the size of the detection range in turns (which is way way less than the width of the universe)
<adrien>
it's sad: galactic algorithms are fun :P
<mrvn>
All in the game is pretty easy except one thing: Mail.
<mrvn>
Sending mail in a universe with lightspeed limitations is damn difficult.
<pippijn>
it's like all other information, right?
<mrvn>
That is just mail too.
zpe has joined #ocaml
<pippijn>
do you consider absorption of mail by black holes?
<mrvn>
no black holes yet
<pippijn>
if a black hole sits between sender and receiver
<pippijn>
no, but later
<pippijn>
if you don't consider that possibility, you just need to compute the delivery time and put it in the receiver's mailbox with a timer
<mrvn>
pippijn: that assumes no routing takes place
<pippijn>
if you do consider it, it's difficult
<pippijn>
then you need to simulate the travel
<pippijn>
hm?
<pippijn>
you put the message in the mailbox of every reachable colony
<mrvn>
Mail goes from A to B to C to D. Say D is enemy territory with a fleet on the way to D.
<pippijn>
and when the timer expires, they have the message and can broadcast it
<mrvn>
Then D should only get the message once the fleet arrives and takes over. right?
<adrien>
you've put your message in R2D2 and a Jedi helps the droid escape
<adrien>
(no? :P )
<mrvn>
But assume the enemy conquers C and then you take C back. Then D should get the message only after you took C back + tiem of delivery.
<pippijn>
if the enemy owns a colony in the exact moment a message timer expires, the message is lost
<pippijn>
every colony (including enemy ones) get the message
<mrvn>
pippijn: yes.
<pippijn>
if you take that colony before the message arrives, it's all good and you receive it
<mrvn>
But C still has the message so it should repeat it every turn so it gets there once the fleet conqueres D.
<pippijn>
oh
<pippijn>
I see
<pippijn>
then you need D to send acks
<mrvn>
At least that is how I imagine you would do it. Keep all messages on a loop so you get them delivered even if for the first few tries the enemy still holds the star system.
<pippijn>
right
zpe has quit [Ping timeout: 264 seconds]
<mrvn>
Sending an ACK takes the same time the original sending took.
<mrvn>
say 5-50 years
<pippijn>
yes
<pippijn>
so you're going to get a big mess of redundant communication
<mrvn>
yep.
<pippijn>
galactic electrosmog
<ousado>
"every colony (including enemy ones) get the message" ?
<mrvn>
The way I'm trying to implement it now is that each colony has an out box with a history. Each turn each colony checks the outbox of each other reachable colony but uses the slot coresponding to the distance / time delay.
<ousado>
you can travel at 0.3 * light-speed but you can't encrypt messages?
<pippijn>
ah
<pippijn>
ousado: sure
<mrvn>
So when D is conquered it checks the outbox of C from 20 years ago and gets any message in that slot.
<pippijn>
ousado: so the enemy ones get encrypted messages
<pippijn>
mrvn: good
avsm has joined #ocaml
<pippijn>
that's a good way
<pippijn>
and then you rotate the array
<mrvn>
ousado: messages are obviously encrypted. So enemy messages are unreadable and thrown away.
<ousado>
you could have a "conquered the encryption key, too" mode
<mrvn>
pippijn: yep. At first I thought I needed to track the history of a message across all of the universe. But I only need the history of the time to cross the detection range. Anything older can't be read by another colony anymore due to dust particles or dispersion or whatever other reason there is a detection limit.
<pippijn>
right
<mrvn>
So maybe 20 slots instead of 1000. Huge win.
<mrvn>
ousado: interesting idea. One would give unique keys to every colony and ship so after conquering the enemy could at most read the mail for that colony.
<pippijn>
ousado: maybe the colonies ke-key on every message delivery
avsm has quit [Ping timeout: 264 seconds]
Neros has joined #ocaml
ontologiae_ has joined #ocaml
snearch has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 246 seconds]
avsm has joined #ocaml
avsm has quit [Ping timeout: 256 seconds]
snearch has quit [Quit: Verlassend]
malo has joined #ocaml
ollehar has joined #ocaml
zpe has joined #ocaml
wmeyer has joined #ocaml
<wmeyer>
hi
<adrien>
o/
<wmeyer>
\o
<adrien>
Damien broke my patches again! ='(
<wmeyer>
:D
<adrien>
(but it should be fairly easy to fix)
<adrien>
hmmm, world.opt finished in 128 seconds
<wmeyer>
update: I am still rescuing my desktop, but laptop now has git-svn, so I should be able to continue working
<adrien>
but it's weird: sometimes it needs 180 seconds
* wmeyer
is downloading knoppix image as new ubuntu live cd does not even show my hdd in /dev
<adrien>
try slax :-)
<ousado>
wmeyer: what happend?
avsm has joined #ocaml
<pippijn>
slax is an alternative syntax for xslt
<pippijn>
I like it
<wmeyer>
ousado: I don't know, I filled up my harddrive by incident, and then machine rebooted, after that I am able only to boot windows but not linux from grub menu, probably some tables went off
<adrien>
haha, not that slax ;-)
<wmeyer>
you mean slackware?
<adrien>
it's based on slackware
<wmeyer>
ah slax
<adrien>
but it's not slackware
<ousado>
wmeyer: wow, which filesystem was that?
<wmeyer>
that's what i thought
<wmeyer>
ousado: it's ext4
<adrien>
first live cd or usb that was actually fast
<ousado>
wmeyer: scary :S
<wmeyer>
I like this chick on the picture, it convinced me i want to buy a pendrive
<ousado>
:)
<adrien>
I like the slackware installer to do some maintenance on machines; it works everywhere :P
zpe has quit [Ping timeout: 240 seconds]
<wmeyer>
what is the most free free distribution of Linux
avsm has quit [Ping timeout: 240 seconds]
<wmeyer>
gnewsense?
<pippijn>
G nuisance
<adrien>
wmeyer: I've changed the name of the "debugger"/"DEBUGGER" variable to "with_debugger"/"WITH_DEBUGGER"; that reflects in the various files that are derived from the configuration
<adrien>
wmeyer: do you think it matters? I don't think it's used inside the ocaml sources
<adrien>
wmeyer: so the only issue might be that another software relies on the values inside the ocaml configurations (is any of them installed on the system?)
<wmeyer>
adrien: it does not matter, I will review patches anyway, we should prefer consistency
<adrien>
ok, good :-)
<wmeyer>
debugger is rarely used
* wmeyer
wanting to write a new debugger based on ocamldebug, general puprose one, pure ocaml except assembler libraries :P
<adrien>
hah, stumbled on this in a .h file: !defined(CAML_JIT)
<adrien>
well, config/Makefile gets installed and there's also compiler-libs/config.cmi (but no implementation file?!=
<wmeyer>
CAML_JIT that's bad that's really bad adrien
<adrien>
)
<adrien>
oh?
* wmeyer
jokes
<adrien>
ok, it seems the only thing that refers to this is Makefile.config; I think it's safe to rename the variable
<adrien>
:-)
<wmeyer>
everything begining with J having in middle I and ending with T is bad
avsm has joined #ocaml
<adrien>
I need to do some more testing on windows; proofreading found a few more things and now I'm confident
<wmeyer>
especially when it's have CAML in the begining
<Drup>
wmeyer: you can JIT caml by going through js_of_ocaml :]
<pippijn>
or ocamlnat
<pippijn>
why isn't ocamlnat in standard ocaml?
<adrien>
it is
<pippijn>
oh
<adrien>
but maybe not built by default
<Drup>
is utop native ?
<adrien>
don't think so
<pippijn>
adrien: as of what version?
<adrien>
3.12 maybe
<pippijn>
hm
<adrien>
maybe it should be built by default but not installed
<pippijn>
I don't see a jit
<adrien>
because it seems it has broken a few times recently
<orbitz>
is there any way to reason about how expensive it is to make a closure?
<mrvn>
orbitz: read the source, compute the cost
<mrvn>
One big hidden cost of closures is that they aren't inlined.
<orbitz>
In my case I have a container of things, and i don't care what they are as long as they implement an interface. Other than objects the only way I know howto do that is with clsoures
<mrvn>
And now you want to reason about the speeds of objects versus closures?
darkf has quit [Quit: Leaving]
<Drup>
orbitz: objects are mostly big closures :p
<orbitz>
No, I'm deciding if the interface should allow them to return a new 'thing', so that the thingsare immubtale. Or users should just be required to trap a reference in their closure if they want something data to change between calls
<Drup>
(btw, depending of what you want, you may be able to do it with modules too)
<mrvn>
Objects have a hashtable of closures while a record of closures is a plain array. Both have access time of O(1) but the hashtbl should have a modulo operation. Should be slightly slower.
<orbitz>
I'm not sure what the preferred solution is in this case. I'd prefer not to use objects since I don't really understand them and I understand closures but I don't want to force something that is painful to use on someone
palomer has joined #ocaml
<mrvn>
orbitz: The closures all need to be bound to the thingy they work on, right?
<mrvn>
assuming they access it at all
<orbitz>
yes, so the 'immubtale' api, is such that do_thing : closure_thing -> closure_thing, and they would recapture their new state in the returend closure
<orbitz>
whereas I could do do_thing : closure_thing -> unit and they just have to use a reference
<mrvn>
orbitz: In the trivial case they would be bound to an int or int ref if being mutable. There it would make a difference.
mort___ has quit [Remote host closed the connection]
<orbitz>
I'm worried if do_thin is called a lot, recapturing new state in a closure coudl be expensive
<mrvn>
orbitz: Anything more complex you would have a tuple or record. And record can have mutable fields. So no ref required.
<orbitz>
but I guess if I do teh first solution, they can always use a reference or something else and just return the input closure
<orbitz>
mrvn: so effectively i'm implementing a plugin-system
<mrvn>
orbitz: The advantage of closure_thing -> unit -> closure_thing is that they can change the closure_thing itself.
mort___ has joined #ocaml
<orbitz>
so plugins return a closure_thing that has all the entry points into the callbacks and the state of that instance ofteh plugin
<mrvn>
orbitz: yeah, plugins can be done that way.
<orbitz>
mrvn: If I read you correctly, sounds like closure_thing solution isn't so bad?
malo has quit [Quit: Leaving]
<mrvn>
orbitz: In plugins the callbacks would be constant. The internal state might change but not the callbacks.
<orbitz>
mrvn: Would they? How would state that changes be encoded?
<mrvn>
orbitz: But think networking, for example a http client. You start with a connected socket waiting for a header. The callback would point to the header parser. When it has parsed the header it would not return itself but the read_body callback instead.
<orbitz>
mrvn: sure, hwoever consider this: I have a plugin that wants to count the number of times it is called
<mrvn>
orbitz: type plugin = { mutable int count; .... } let callback state () = state.count <- state.count + 1; () and then you have (callback plugin) as your closure.
<orbitz>
i'm considering encoding it like let callback state = fun () -> state () + 1 end
<orbitz>
mrvn: ok, so you'd use something mutable there
mye has quit [Quit: mye]
<mrvn>
You need something mutable somewhere
<orbitz>
In the example of (do_thing : closure_thing -> closure_thing) you always get a new clsoure back where the change could happen
<mrvn>
orbitz: how then would you access the count to e.g print it?
<mrvn>
orbitz: I feel for it to be usefull you need the state used in do_thing to be shared with other functions too.
iZsh has quit [Quit: Coyote finally caught me]
<orbitz>
mrvn: could be closerto an object: type closure_thing = { callback : closure_thing -> closure_thing; get_count : unit -> int } (not particualrly general but just an example)
shinnya has joined #ocaml
<mrvn>
orbitz: Ok, The calling callback would modify both callback and get_count. That would work.
<orbitz>
yes, sorry for taking so long to get to what was in my head
<mrvn>
s/The/then/
<orbitz>
the interface doesn't sound too terrible to work with. and if the user wants to use a reference instead they can
<mrvn>
Rebuilding the whole closure_thing record for every change will be more expensive than a mutable or ref.
<orbitz>
Okay, I think i will go with this interface. It sounds easier to reason about to start off with and there is room for someone to make optimizations if they want
<mrvn>
orbitz: you can also to type closure_thing = { mutable callback : closure_thing -> unit; mutable get_count : closure_thing -> int; }
<orbitz>
ok
<mrvn>
orbitz: Then callback and get_count can modify the closure_thing directly if they want.
demonimin has quit [Remote host closed the connection]
<orbitz>
with the non-mutable version they can always do that with a reference too I think. Perhaps I'm unreasnably afraid of mutability thouhg
<mrvn>
orbitz: with a reference they can have mutable state but can't change the callback itself.
demonimin has joined #ocaml
<mrvn>
All 3 options work as do objects. They just fit best in different situations.
<orbitz>
thanks for hte feedback, mrvn
<mrvn>
Maybe if you explain where it is to be used we can narrow it down more.
<orbitz>
This will be used in a logging framework I'm writing, where you specify backends via plugins
osa1 has quit [Quit: Konversation terminated!]
<mrvn>
so the callbacks will generaly not change and you only have some internal state of the plugins to deal with.
avsm has quit [Quit: Leaving.]
<mrvn>
Maybe use a GADT to make an universal type out of the plugins: type 'a plugin' = { data : 'a; callback : 'a -> unit; } type plugin = Plugin : 'a plugin' -> plugin
<mrvn>
Or use first class modules
<mrvn>
sorry to give you more options to consider. :)
mye has joined #ocaml
<orbitz>
hah, i think i'm goingto go with the simplest one i understand: type plugin = { log : Log.t -> plugin -> plugin; destroy : unit -> unit }. And if making the closure each time is expensive they can just encode a reference in the plugin and return the same closure in 'log'
<mrvn>
let log line plugin = Printf.printf "%s\n" line; plugin will work fine. no need to recreate the plugin every time.
<orbitz>
yeah exactly
snearch has quit [Quit: Verlassend]
<orbitz>
but some log plugins might want to count things (like how many error logs occured)
<orbitz>
in which case they can recreate or use a ref
<mrvn>
orbitz: then they can use a ref, mutable or modify plugin every time. Their choice.
<orbitz>
yep :)
<orbitz>
thansk mrvn
<mrvn>
it certainly works.
<orbitz>
hopefully it doesn' tsuck. not live threatening if it does thouhg
<mrvn>
With just 2 functions it also isn't expensive. Just when you get to 10+ functions it can become tiresome to recreate the callbacks on change.
<orbitz>
yeah
<mrvn>
or with lots of state. As state grows you want to just stuff it into a mutable record and have only that to carry around.
<mrvn>
I did it once that way but returning a plugin option. By returning None the plugin got automatically removed.
mars-92 has quit [Quit: leaving]
palomer has quit [Ping timeout: 240 seconds]
Neros has joined #ocaml
introom has quit [Remote host closed the connection]
palomer has joined #ocaml
gautamc has quit [Read error: Connection reset by peer]
gautamc has joined #ocaml
palomer has quit [Ping timeout: 256 seconds]
zpe_ has quit [Remote host closed the connection]
Sim_n has quit [Read error: Connection reset by peer]
ygrek has quit [Ping timeout: 246 seconds]
Xom has joined #ocaml
Neros has quit [Ping timeout: 264 seconds]
Yonex has quit [Read error: Connection reset by peer]
ggole has quit [Ping timeout: 264 seconds]
goodmanio has quit [Excess Flood]
k3VB6u4d has joined #ocaml
k3VB6u4d has quit [Excess Flood]
ollehar has quit [Ping timeout: 240 seconds]
k3VB6u4d has joined #ocaml
mye has quit [Quit: mye]
palomer has joined #ocaml
ollehar has joined #ocaml
Neros has joined #ocaml
<mrvn>
I'm splitting up a large file into seperate modules. Now I have a module type T = sig ... end. Putting that in t.ml seems a bit silly.
<mrvn>
module type T is used as common type for several modules and input for functors.
<mrvn>
Ideas how to name the file?
<orbitz>
what's t actually rerepsent?
<mrvn>
An interface for encoding/decoding data for network transmission.
<orbitz>
I would consider naming it something a long those lines. Maybe codec.ml?
malo has joined #ocaml
<mrvn>
Is there a way to access the std module Hashtbl other than Hashtbl? Because I want to have a file called net/src/Hashtable.ml that implements Net.Hashtbl based on std Hashtbl.
<orbitz>
mrvn: I'm not sure if this helps you but I know core does things like make core_string.ml and that includes the real string, then net.ml would have module Hashtbl = Mrvn_hashtbl
<mrvn>
Circular build detected (net/net.cmo already seen in [ net/src/net.cmo; net/net.cmo; net/net.cma ])
<mrvn>
I hate fighting with oasis / ocamlbuild
<orbitz>
I have my own horrible build system in Make
<orbitz>
It's not very good, but I understand it at least
<orbitz>
Honestly, I know it's heretical, but all I want are buidl systems to make me Makefile's I can execute.
demonimin_ has joined #ocaml
demonimin has quit [Ping timeout: 246 seconds]
<mrvn>
Can I have a net.ml is a pack called net?
<mrvn>
Wouldn't that make it Net.Net?
<orbitz>
I don't beleive packs will work for you here if you want to use the method said above
<orbitz>
The pack in core is called 'Core' and the core_string -> String trick is in std.ml
<orbitz>
mrvn: are teh .t's private? or hidden maybe?
weie has quit [Ping timeout: 256 seconds]
<mrvn>
Nope.
<mrvn>
Is there a way to inspect the contents of an mli file?
<mrvn>
cmi I mean
wmeyer has joined #ocaml
<mrvn>
The problem seems to be that net.cmi only contains a reference to NetConnection_type and NetConnection_type.cmi is not visible to the main code.
<mrvn>
Got it working now. This is quite odd. If I have module type T in NetCore.ml then NetHashtbl.ml breaks "Unbound module type NetCore.T" when I instanciate the functor. But if I move T into NetHashtbl.t then it works.
<adrien>
wmeyer: I too was surprised that enabling parallel builds of ocaml meant reducing parallelism :P
<adrien>
wmeyer: will continue this after sleep + swimming-pool
<adrien>
night
<wmeyer>
adrien: hello
<wmeyer>
I almost commited your patches there is one small glitch in the install step
malo has quit [Quit: Leaving]
chrisdotcode has joined #ocaml
<orbitz>
Failure: "invalid long identifier type"
<orbitz>
that's an interesting error
<mrvn>
How do I build the cmi file for a lib so it includes all it sub files?
<orbitz>
mrvn: what do you mean?
<orbitz>
as in a pack?
<pippijn>
adrien: by the way, I also can't count when I'm swimming
<orbitz>
Is there a better alternative to linear types if you want to guarantee cleanup of resources?
<mrvn>
is github borken or am I too stupid to clone a repository?