pantsd has quit [Read error: 110 (Connection timed out)]
pants1 has quit [Read error: 60 (Operation timed out)]
darinm has joined #ocaml
<darinm>
anyone know about an interface mismatch problem when trying to compile camlp5 with ocaml 3.10.2? I get the same problem (Error while loading "./pa_lispr.cmo": interface mismatch on MLast.) with both camlp5 5.08 and 5.09
pantsd has joined #ocaml
Associat0r has joined #ocaml
darinm has quit []
thelema has joined #ocaml
tar_ has quit ["byebye"]
davidm123 has quit ["ChatZilla 0.9.83 [Firefox 3.0.2/2008091620]"]
pantsd has quit [Connection timed out]
electronx has joined #ocaml
Submarine has joined #ocaml
Snark has joined #ocaml
Mr_Awesome has quit [Remote closed the connection]
Mr_Awesome has joined #ocaml
seafood has joined #ocaml
snhmib has quit ["Good riddance!"]
seafood has quit [Connection timed out]
bluestorm has joined #ocaml
bluestorm has quit [Client Quit]
electronx has quit []
johnnowak has joined #ocaml
Palace_Chan has joined #ocaml
olgen has joined #ocaml
<Palace_Chan>
i seem to have a type error beginning in line 17 here that i dont know how to fix...it's only a "type" error so i figured somebody more experienced in ocaml could see it: http://pastebin.com/d6abfca1e
Palace_Chan has quit [Client Quit]
Palace_Chan has joined #ocaml
<olegfink>
Palace_Chan: what's the (x y z) notation you use in lines 17-20?
<olegfink>
my guess is that it should be a list construction similar to other cases in the match
<Palace_Chan>
so yes, the other cases in the match are one, the diff is i give more than one there
<Palace_Chan>
but the error i get when i compile
<Palace_Chan>
is strange, it says: File "expressions.ml", line 40, characters 26-31:
<Palace_Chan>
Syntax error
<olegfink>
first of all, that's not a type error
<Palace_Chan>
true
<Palace_Chan>
but i then added
<olegfink>
and as I already said, there isn't such notation in ocaml
<Palace_Chan>
::
<Palace_Chan>
(as in the lower match cases)
<olegfink>
so?
<Palace_Chan>
that gives me: This expression has type 'a list but is here used with type X86lite.LInsn.t
<olegfink>
could you paste the version you're currently working with? that would help a lot.
<Palace_Chan>
which confuses me because apparently the overall return type is a list type
<olegfink>
the first three cases in your match don't have a type of 'a list
<Palace_Chan>
hmm which is what i apparently should be getting, you mean they need :: too ?
<Palace_Chan>
although at the end of the match there is a ::
johnnowak has left #ocaml []
<olegfink>
if I understood correctly, your match looks like this:
<Palace_Chan>
i started getting that problem when i added the matches with more than one line today
<olegfink>
LInsn.Add (esp, CImm 4l) :: ( the match ) :: :: accum_r
<olegfink>
neverminf the double ::.
<Palace_Chan>
yes
<olegfink>
well, you know x::xs is a 'a list
<Palace_Chan>
true, so that is why i added :: to the match cases with more than one line
<olegfink>
but you can't use 'a list in the position of x
<olegfink>
wrong, the whole match should have type X86lite.LInsn.t
<Palace_Chan>
ohh, i have to use @ ?
<olegfink>
no, your match shouldn't be of type list at all
<olegfink>
otherwise the latter :: doesn't make any sense
<Palace_Chan>
then there would be no way of getting those multi-lined match cases
<olegfink>
there is.
<olegfink>
turn the last :: into @
<olegfink>
and surround any non-list cases in match with either [ ] or add ::[] after them
<Palace_Chan>
so like line 17 for example ?
<olegfink>
what's with line 17?
<Palace_Chan>
ah surrounding with []....by last :: do you mean the last one in the multi-Insn cases ?
<olegfink>
no, the one that is :: accum_r
<Palace_Chan>
non-list cases would be those like line 9 ?
<olegfink>
yes, just turn them into one-element lists
<Palace_Chan>
let me give that a try
<olegfink>
a saner option is to surround them with [...], a future-proof version (in case you'd want to add more instructions to them) is to add ::[] after
<olegfink>
by the way, you miss that [] in multi-instruction cases too
<olegfink>
remeber :: is 'a -> 'a list -> 'a list
<Palace_Chan>
right, so a multiline needs [ and ] at the end with , separating the elements i guess
<olegfink>
see, there are several ways to define a list
<olegfink>
[1;2;3] is the most common
<olegfink>
what you're trying to do is 1::2::3::[]
<olegfink>
which is also possible
<Palace_Chan>
oh semicolons..oops
<olegfink>
do you study at penn?
<Palace_Chan>
thanks for the help, yea
<olegfink>
I wish we also had some ocaml courses here.
<Palace_Chan>
it's not an ocaml course (which is why you can see how my ocaml SUUUCKS)
<Palace_Chan>
it seems pretty nice but i need to actually try and learn it a bit more as in itself so i could appreciate it more (so far inrias manual has been all)
<olegfink>
well, it's probably some compiler course, but you seem to be forced to use ocaml for X86Lite stuff
<Palace_Chan>
yes indeed, its a compiler course
<Palace_Chan>
wow it compiled
<Palace_Chan>
took me a while to get use to ocaml types....at least less confused with stuff like 'a -> ('a -> 'b -> 'a list) -> 'a * 'a -> 'b etc....
<olegfink>
they torture as with java here :(
<Palace_Chan>
for compiler writing ?
<olegfink>
as if.
<olegfink>
just stupid java.
<olegfink>
well, ocaml's type system is pretty much usual algebraic stuff.
olgen has quit []
<Palace_Chan>
lol java, at the moment i have a much much harder time using ocaml than even C but i can see how its pretty neat if i had some more time to learn it properly
<olegfink>
that's the point
<olegfink>
when I started learning ocaml, I was quite familiar with C and sometimes ocaml made me cry
<olegfink>
but nowadays I just can't do java properly -- it misses just everything! where's currying? higher-order functions? closures?
<Palace_Chan>
they "taught" us ocaml in a day so i feel like im still hacking my way around it...i even feel happy when i go back to double pointers, pthreads and forking compared to not even understanding syntax errors
<Palace_Chan>
did you use any resources aside the manual and stdlib to learn ocaml ?
<olegfink>
but the bonus is, that once you fix your type errors you have very high chances that your code will work properly
<olegfink>
hmm, I think I used my teacher a bit
<olegfink>
we had an ocaml course in secondary school
<Palace_Chan>
yea i guess, ill have to learn it some more as soon as i get rid of this compiler course
olgen has joined #ocaml
<olegfink>
so the initial stuff - like understanding its type system and functional languages as a whole -- wasn't from a book for me
<Palace_Chan>
functional languages as a whole...it's a leap from the usual way of thinking in C family and java and those
<Palace_Chan>
like 2 weeks ago i would be in here asking about those 'a -> 'b -> etc.. chains
<olegfink>
yeah, and I'm thankful this leap was done pretty early and having some people to talk to about those matters.
<olegfink>
functional programming is a bit difficult to master if you're used to C, but then you'll miss every feature of it in an imperative language
<olegfink>
when we were studying ocaml, we often wrote the program in C and then translate it to ocaml
<ozy`>
that's weird
<olegfink>
then we started learning java and tried to do the opposite, which was much more painful
<ozy`>
translate ocaml into java?
<olegfink>
yep.
<Palace_Chan>
strange, like OO ocaml into java at least ?
<olegfink>
I just can't get why do you need an explicit for loop if all you want is to print out your array's elements.
<ozy`>
Java was designed with the mindset that starting with C++ and removing features would result in a more useful language
<olegfink>
I don't mean literate translation, it's just that it's easier to think in functional programming for me these days
<ozy`>
and since C++ doesn't have a way to distinguish automatically between a pointer and an array...
<Palace_Chan>
easier ? interesting, as im new to ocaml it still sorta blows my mind...but mostly syntax wise for now since im so new to it
<olegfink>
ozy`: ...java decided to hide pointers.
<ozy`>
olegfink: and it didn't occur to its designers that that was the perfect opportunity to introduce useful array-specific syntax
<Palace_Chan>
aight, it's like 5 am, thanks for the help ill go sleep a bit
<ozy`>
because after all, the main goal was to remove features
Eridius has left #ocaml []
<ozy`>
(at least, to remove language features, not implementation features)
<olegfink>
see, people still prefer C with GObject for OOP
<olegfink>
this pretty much proves that java has failed to be useful
<olegfink>
coding mainly in java now, I still can't understand how it's possible
olgen has quit []
<Palace_Chan>
why C with GObject rather than C++ ?
<olegfink>
speaking of which, does ocamljava has the ability to call java methods?
<olegfink>
Palace_Chan: _I_ have no idea. I tried to speak to some developers, they say it's more useful.
<ozy`>
I've never heard of GObject
<Palace_Chan>
C with GObject than C++ ? interesting
<Palace_Chan>
i wonder why
<olegfink>
ozy`: it's cfront take #2
<olegfink>
another set of preprocessor macros to add classes to C
<ozy`>
olegfink: never heard of cfront either...
<ozy`>
don't worry though, I looked up GObject :p
<olegfink>
cfront was the first implementation of what became C++
<ozy`>
ahhh
<olegfink>
it was a preprocessor emitting C
<Palace_Chan>
anyways gnight
Palace_Chan has quit [Client Quit]
<olegfink>
GObject is pretty much the same, unportable (it sort of works only with GCC), not even having its own preprocessor (uses cpp)
<ozy`>
I knew that C++ used to emit C
<ozy`>
but not what it was called in those days
<olegfink>
the question of the day is, why do they had to stay with C syntax?
<olegfink>
so the usual code in GObject looks like: