wazze has quit ["If we don't believe in freedom of expression for people we despise, we don't believe in it at all -- Noam Chomsky"]
Nutssh has quit ["Client exiting"]
Nutssh has joined #ocaml
gim|570 is now known as gim
async has joined #ocaml
blueshoe has quit [Read error: 104 (Connection reset by peer)]
Nutssh has quit ["Client exiting"]
ayrnieu has joined #ocaml
blueshoe has joined #ocaml
stepcut has quit ["ERC Version 4.0 $Revision: 1.577 $ (IRC client for Emacs)"]
vect has left #ocaml []
<async>
is it conceivable to write an operating system in ocaml? (minus the boot stages)?
vect has joined #ocaml
<Smerdyakov>
It is conceivable to write a lot of an operating system in OCaml.
<Smerdyakov>
You'll need to write a garbage collector in another language at some point, though. :)
<Riastradh>
Oh? T's garbage collector was written in T, Smerdyakov.
<Smerdyakov>
But not OCaml's.
<ayrnieu>
(Forth, also, has its garbage collector written in Forth =)
<ayrnieu>
async - you may find it more interesting to start rewriting parts of a real kernel in O'Caml.
<Riastradh>
Smerdyakov, irrelevant; my point was that you don't _need_ to write a garbage collector for a language X in a language that is not X.
<Smerdyakov>
Riastradh, well, with something like region inference you might get away with writing an OCaml GC in OCaml.... but I don't think the current ocaml compilers can support creation of a GC that doesn't need a GC.
<Riastradh>
Smerdyakov, obviously it would be no small task to redesign the run-time system with a garbage collector in OCaml.
<Riastradh>
But that's not the point. It would be no small task to redesign the run-time system to work stand-alone as the basis of an OS, either.
<Smerdyakov>
I have a feeling you are saying what I was saying.
<Riastradh>
No. You were saying 'you will _need_ to write a garbage collector in another language at some point, though.'
<Riastradh>
Your use of 'will' (unless you meant 'shall,' though I doubt it, given the context of the contraction) indicates a _definite_, _plain_ future.
<Smerdyakov>
Well, there are alternatives, but they are dumb ones.
<Riastradh>
?
<Smerdyakov>
There is no other reasonable way to "write an OS in OCaml."
<Riastradh>
Did you completely ignore my series of messages to the effect that it is possible to write the garbage collector of an implementation of a language X in X?
<Smerdyakov>
No, and that is not a reasonable thing to do here.
<Riastradh>
Why not?
<Smerdyakov>
Because it involves reimplementing OCaml runtime stuff, which you could just do in the first place to bootstrap your OS.
<Riastradh>
Which you would be doing _anyways_.
<Riastradh>
I don't see the point you're making here.
<Smerdyakov>
I think this depends on whether we count twiddling a C runtime system as implementing a garbage collector.
<Smerdyakov>
I admit that my terminology was bad, as I mean to include such cases as implementing garbage collectors.
<Riastradh>
Need the run-time system be implemented in C anyways?
<Smerdyakov>
It is now.
<Smerdyakov>
So anything else will be full-scale implementation, not twiddling.
<Riastradh>
Right, so reimplementing it _anyways_, you could just as easily rewrite the garbage collector in OCaml.
<Smerdyakov>
No, because then you'd have to implement region inference or similar in the OCaml compiler, beyond just creating runtime systems.
<Riastradh>
Do you really think it would just be a bit of twiddling to make it run stand-alone?
<Smerdyakov>
I will not accept a garbage collector that has its own garbage collector as a reasonable solution.
<Riastradh>
No, not a garbage collector that has its own garbage collector. The T garbage collector implemented the garbage collector and did not have a garbage collector running underneath it.
<Smerdyakov>
T is not OCaml.
<Riastradh>
T may not be OCaml, but it demonstrates well enough the possibility of the garbage collector being implemented in the language that it collects garbage for.
<Smerdyakov>
How do you handle functions in the OCaml GC, when a function is a heap-allocated closure?
<Riastradh>
A function defined at the top level of a module cannot be redefined, so it needn't reside in the heap. Other closures, less significant ones, can be stack- or register-allocated, though I don't know enough about the OCaml compiler to say if it allocates closures anywhere other than the heap.
ayrnieu has quit [Read error: 113 (No route to host)]
<Riastradh>
The T garbage collector was written _very_ carefully, of course, and by the compiler-writers, who knew _very_ well _exactly_ when the compiler would generate code to allocate on the heap.
<Smerdyakov>
I think it's fair to say that it's not clear enough to OCaml developers where the OCaml compiler does heap allocation to be able to say easily whether or not it's possible to write a GC in it.
<Smerdyakov>
You can talk about possible optimizations ("you can stack allocate this," etc.), but if the OCaml compiler doesn't implement these, they're not relevant.
<Riastradh>
Now, as I said, I don't know enough about the OCaml compiler to tell whether or not it does this, but I doubt that it would allocate _only_ on the heap, just as Orbit produced code that allocated quite a lot of closures on the stack and in registers.
<Riastradh>
Is your long silence a preparation for a long response; a quiet, fuming defeat; or a realization of how bloody annoying such little issues dragged out in long arguments is?
<Smerdyakov>
Didn't we just come to an agreement?
<Riastradh>
What agreement?
<Smerdyakov>
"It depends on details of the OCaml compiler."
<Riastradh>
Yes, of course it does. Who cares? There's only one (that I know of, anyways) that you'd be using for this.
<Smerdyakov>
Well, supposedly we care, since this is related to what we were arguing about.
<Riastradh>
Of course one could not write a garbage collector that could work through multiple (hypothetical) OCaml implementations.
Nutssh has joined #ocaml
blueshoe has quit [Read error: 54 (Connection reset by peer)]
async has quit [Read error: 54 (Connection reset by peer)]
async has joined #ocaml
blueshoe has joined #ocaml
Swynn_hm_afk is now known as Swynn_hm
Herrchen has quit [Read error: 110 (Connection timed out)]
cjohnson has quit ["Got to be good lookin' 'cause he's so hard to see."]
ayrnieu has joined #ocaml
async has quit [Read error: 110 (Connection timed out)]
async has joined #ocaml
<blueshoe>
pino, perl does not have static type checking
<blueshoe>
oops
<Nutssh>
Heh. Hi
<blueshoe>
apparently i was wrong
<Nutssh>
?
<blueshoe>
allegedly perl 5.8 has it
<blueshoe>
i've asked for proof :)
<Nutssh>
Maybe between lists and strings and hash tables?
<blueshoe>
<pino> you can typify your vars :)
<blueshoe>
join #hprog
<blueshoe>
<pino> let me find it :)
<async>
static type checking in ocaml would be cooler if there were ways to circumvent it ;)
Herrchen has joined #ocaml
<ayrnieu>
async - when would you want to do that?
<async>
well, for instance, if you want to write something like a hashing function
<Nutssh>
What kinds of circumvention.. Oh, that.
<Nutssh>
IMHO, thats a wart on the language. A damned useful wart, but a wart.
<async>
definately
<Nutssh>
I vaguely recall that you can access the raw binary representation of an object?
<async>
Nutssh I believe you're right (using the Marshal library), so disregard that previous statement
Nutssh has quit ["Client exiting"]
blueshoe has quit [Read error: 54 (Connection reset by peer)]
blueshoe has joined #ocaml
mimosa has joined #ocaml
Nutssh has joined #ocaml
Nutssh has quit [Read error: 104 (Connection reset by peer)]
Nutssh has joined #ocaml
gim_ has joined #ocaml
blueshoe has quit [Read error: 54 (Connection reset by peer)]
ott has joined #ocaml
<ott>
re all
blueshoe has joined #ocaml
Nutssh has left #ocaml []
async has quit []
Demitar has joined #ocaml
blueshoe has quit [Read error: 54 (Connection reset by peer)]
Swynn_hm is now known as Swynn_hm_afk
wazze has joined #ocaml
<Maddas>
hrm
<Maddas>
is it possible to construct the patterns in pattern matching on the fly?
<Maddas>
Even at compile-time would be enough
<Maddas>
I have a list with characters I want to match, I don't want to iterate through the list but use pattern matching for efficiency :-)
<Maddas>
Merely for convenience I'd like to be able to specify the list and have a function do the pattern matching, extracting the characters
<Maddas>
I guess it might not be doable this way, but I'm not sure.
<Maddas>
Is there anything like C's chr() and ord()? I'm having problem with characters with umlauts in my source file, so I thought I might just specify them this way
<Maddas>
String declares external char_chr and external char_code, but I can't access them from outside it seems.
<Maddas>
Oh, there is a Char module. Ignore the last question then.
karryall has joined #ocaml
blueshoe has joined #ocaml
blueshoe has quit [Read error: 104 (Connection reset by peer)]
durnew has joined #ocaml
durnew has left #ocaml []
mattam_ has joined #ocaml
ejt_ has joined #ocaml
<ejt_>
hi
<ejt_>
does anyone know why I can't pass (::) as a function ?
<ejt_>
ie. (+);; works
mattam has quit [Read error: 110 (Connection timed out)]
<ejt_>
but (::);; is a syntax error
<Maddas>
ejt_: I don't know why, but I have already observed that :)
<Maddas>
What are you trying to do?
<ejt_>
fold_file (flip (::)) [] "/etc/passwd"
<Maddas>
Isn't there any explicit version?
<Maddas>
A named function for which :: is simply an alias
<Maddas>
just like List.concat is @
<smkl>
:: is a data constructor, not a function
<ejt_>
that would be good, can't see it in List though
<Maddas>
True, actually
<smkl>
@ is List.append .. List.concat is same as List.flatten
<Maddas>
You can't curry constructors (Afaik)
<Maddas>
smkl: oops :-)
* ejt_
adds cons to his personal prelude.ml
<karryall>
ejt: + is a function
<karryall>
:: is a constructor
<ejt_>
karryall: y, I didn't know you couldn't slice constructors, thx
<karryall>
ah, didn't see smkl reply
ejt_ has quit ["leaving"]
ott has quit ["×ÁÌÉÔØ"]
blueshoe has joined #ocaml
wazze is now known as afkts
<ejt>
wow, there isn't an 'id' function
mellum has quit ["ircII EPIC4-1.1.11 -- Are we there yet?"]
cjohnson has joined #ocaml
_JusSx_ has joined #ocaml
<_JusSx_>
wuuru : heya
<wuuru>
_JusSx_: :-)
afkts is now known as wazze
teratorn has quit [Read error: 54 (Connection reset by peer)]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
__DL__ has joined #ocaml
karryall has quit ["home"]
mattam_ is now known as mattam
Nutssh has joined #ocaml
blueshoe has joined #ocaml
Nutssh has quit [Client Quit]
Nutssh has joined #ocaml
Nutssh has quit ["Client exiting"]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
<_JusSx_>
s
Nutssh has joined #ocaml
Chimp has joined #ocaml
det has joined #ocaml
Chimp has quit ["leaving"]
det has quit [Client Quit]
det has joined #ocaml
housetier has joined #ocaml
housetier has quit [Client Quit]
housetier has joined #ocaml
Nutssh has quit ["Client exiting"]
housetier has quit ["well, she came back and threw me out! see you in a few days (I hope)"]
blueshoe has joined #ocaml
maihem has joined #ocaml
<yella>
is it possible to write an ocaml function in camlidl that returns a 'int list' or whatever list..?
<yella>
in the idea of: int function([out, mltype("int list")] int ..)
<yella>
(which does not work of course)
_JusSx__ has joined #ocaml
teratorn has joined #ocaml
teratorn has left #ocaml []
teratorn has joined #ocaml
maihem has quit ["Client exiting"]
_JusSx_ has quit [Read error: 110 (Connection timed out)]
<blueshoe>
c/sl
<blueshoe>
grr
<Swynn_wk>
hmmm ... I wrote my 1st recursive function (yay!) that does the same as "for i = n downto 1 do print_int(n); print_newline() done", but I can't figure out how to do a recusive function to go from 1 to n
<Swynn_wk>
my recursive function that goes backwards is: let rec myfor n = match n with 1 -> print_int(n); print_newline() | _ -> print_int(n); print_newline(); myfor(n-1);;
<Smerdyakov>
There are other ways to test integers than pattern matching, you know.
<Swynn_wk>
oh?
<Demitar>
You'll want to define an auxiliary function inside the main function if you want it to work the same way though.
<Swynn_wk>
ahhh ic
<Swynn_wk>
yea I've seen that before
<Swynn_wk>
so in this case ... I'd be better off not using recursion? (and using a for loop instead?)
<drWorm>
you want tail recursion in any case
<drWorm>
oh, it was tail recursive, never mind :)
<Swynn_wk>
:P
<Swynn_wk>
is 'tail recursion' where it decreases to for example 1?
<drWorm>
tail recursion is just when the recursive call is the last thing that happens
<Swynn_wk>
ahhhh
<drWorm>
that way ocaml doesn't need to add to the stack, so no stack overflows
<Swynn_wk>
ohhhh ... didn't know that
_JusSx__ has quit ["BitchX: the un-Cola"]
<Swynn_wk>
does that apply to other languages as well? or just ocaml?
Swynn_hm_afk has quit [Remote closed the connection]
<mimosa>
all languages
<mimosa>
(if the compiler makes the optimisation of course which is the case most of the time I think)
<Maddas>
mimosa: I doubt it
<mimosa>
why ?
<mimosa>
maybe not all languages
<Maddas>
Do Java or C do it?
<mimosa>
I thing gcc does that
<Maddas>
I *think* GCC has some tail-recursive optimization, but I don't think it does tail-call optimization
<mimosa>
it not very complicated to reuse the space of the activation record
<Maddas>
well, tail recursion is all that matters here :)
<Maddas>
sure, but I still don't think too many languages do it
<ayrnieu>
maddas - not reliably -- meaning 'not at all', for practical purposes.