jemfinch` changed the topic of #ocaml to: nob: it's not an option keyword. It's a datatype. 'a option. It can be either "None" or "Some data" -- it represents either data that's not there (None) or data that's there (Some data)
<JGibson>
heh, what sets it apart from something like bitchx
<Taaus>
I'm not sure.. Less useless ansi art and silly quit messages, I guess.
<JGibson>
hehe
<Taaus>
Also, you can upgrade the client without disconnecting... Although I don't know if BitchX doesn't support this.
<Taaus>
Scripting in perl is nice, though :)
<Taaus>
(Compared to, argh, mIRC scripting)
<JGibson>
i've never found a need for scripting. of course, i just chat. nothing fancy
<Taaus>
Okay...
<JGibson>
?
<Taaus>
? ?
<JGibson>
was that 'okay...' like a 'okay whatever, you dork who doesn't use scripting' or what
<Taaus>
Oh, nono... I didn't mean it like that.
<Taaus>
More like 'Okay, I can accept that' ;)
<JGibson>
ah heh
<samx>
i don't really think scripting is powerful enough in irc, to really be too useful
<samx>
(irc clients that is)
<Taaus>
samx: I'm not sure I understand what you mean...
<JGibson>
samx, even with being able to use perl?
<samx>
i don't mean the scripting language. i'm sure the languages they have are powerfull, but what you can do with scripting and irc.. is very little. the protocol and the clients are just too static to really make anything really useful
<JGibson>
we're not trying to make irc scripts that do your tax returns here
<Taaus>
I'm still not sure I understand what you mean... :/
<Taaus>
What is it you don't think is possible with IRC? If anything.
<samx>
for example, you can't really do extensions on the way you can 'conference' with other people, or on how the channel looks.. because the channel will only appear different, if you are running the script. and because you are running the script, you must have downloaded and installed it from somewhere.. and that would bring lots of security concerns etc, in addition to being a pain in the *ss
<Taaus>
Hmm...
<Taaus>
Well, irssi isn't solely an IRC client :)
<Taaus>
If you want security, use SILC ;)
<samx>
you can't make a script that allows everyone on the channel to play hearts (card game) with each other, because you would be the only one running the script
<JGibson>
sure you can
<samx>
ok, yes, you can make a text based one, but i mean something decent
<JGibson>
there are scripts that have an input format, like if i type "!go x3 y4" the script will recognize that as a move in the game, and output the new state
<samx>
with a gui etc
<Taaus>
samx: You want IRC to transmit GUI information? :P
<JGibson>
that's not irc anymore ;) it'd be like making emacs into a fps game
<malc>
JGibson: fps game in emacs wouldnt surprise me a bit ;)
<JGibson>
hehe
<samx>
taaus, no, secure distributed scripting.
<Taaus>
That won't make what you propose possible...
<Taaus>
There's no way I can get a GUI controlled by my IRC client...
<samx>
jgibson, no, that would not be irc anymore. but something irclike with a strong scripting language
<samx>
taaus, if you read what i said earlier.. 'irc and irc clients are just too static to do that'
<JGibson>
Taaus: sure you could. make the messages you send be xml or something, and the gui sits on top of irc interpreting those
<malc>
fuck XML go ASN.1
<JGibson>
what's that?
<samx>
uh oh, the xml word. antichrist
<JGibson>
haha
<Taaus>
JGibson: I run Irssi in a SSH session... There's no way (barring new and fancy developments in PuTTY ;) I can get it to do anything graphical.
<JGibson>
i've never heard anyone not like xml before
<malc>
JGibson: a friend of mine had a talk and thesis labeled 'XML is a fashion'
<JGibson>
you have a link to a paper or something?
<malc>
no, and i can ask him. he is doing his military service atm
<malc>
can = cant
<JGibson>
nah, it's ok. you have any of the major points he made?
<malc>
i havent read it. he only mentioned it by name
<JGibson>
ah
<Taaus>
samx: I don't see how any of the things you mentioned can't be implemented using scripts... Of course, needing a GUI would exclude all the text-mode users...
<JGibson>
Taaus: unless your text mode client had a script to filter out the gui codes
<Taaus>
JGibson: Of course... But that wouldn't give it a GUI ;)
<samx>
it doesn't give anything new compared to existing stuff. it's much too verbose, having entities and attributes both doesn't really make sense, as you only need one of them, but it makes the confusion of which to use, etc
<JGibson>
well, the main benefits as i see it are that it has a good critical mass. it also lets you share parsers
<Taaus>
samx: I agree about XML... Having both attributes and entities where one of them could do is kinda redundant...
<JGibson>
ok, what about sgml, the mother of all markup languages
<malc>
I wonder why they choose SGML tagged syntax over sexps..
<malc>
zero sense
<JGibson>
sexps?
<malc>
symbolc expressions
<JGibson>
if you used that, wouldn't your document be a little program of sorts?
<Taaus>
JGibson: Ever seen XSLT? ;)
<malc>
no
<JGibson>
no
<Taaus>
XSLT is some sort of XML-based programming language... I hear it's functional, but what I've seen has been too nasty to decide (I.e. the cluttered syntax scared me ;)
<JGibson>
haha i think i'll steer clear of that
<Taaus>
Having commands with a <command /> syntax is really nasty :/
<samx>
jgibson, oh, but overall, i think the most annoying thing about xml to me is, how it's advocates as something that solves pretty much everything.. it's a god damn file format. it doesn't solve anything. you still need to code the actual stuff. and doing a parser for a file format is usually the easiest problem to solve in any programming project
<malc>
samx: not so for XML
<malc>
making a parser for XML is anything but easy
<JGibson>
i agree. anything can be annoying when over hyped
mellum has quit ["Leaving"]
__DL__ has quit [Remote closed the connection]
jemfinch has quit [Remote closed the connection]
malc has quit ["no reason"]
MegaWatS has joined #ocaml
<MegaWatS>
heellooooo
<awwaiid>
howdy
GnuVince|AwAy is now known as GnuVince
JGibson___ has joined #ocaml
JGibson has quit [Read error: 110 (Connection timed out)]
jemfinch has joined #ocaml
jemfinch has quit [Client Quit]
jemfinch has joined #ocaml
samx has quit [Read error: 110 (Connection timed out)]
__DL__ has joined #ocaml
Cryptor has joined #ocaml
Cryptor has quit [Read error: 113 (No route to host)]
comatoast has joined #ocaml
frog has joined #ocaml
frog has quit [Client Quit]
malc has joined #ocaml
comatoast has quit ["Whoosh!"]
malc has quit ["no reason"]
proff has joined #ocaml
Taaus has quit ["leaving"]
Taaus has joined #ocaml
JGibson___ has quit ["WHAT, CLOWN?!"]
<MegaWatS>
hi
<MegaWatS>
anyone here?
<Taaus>
Verily.
<MegaWatS>
ah :)
<MegaWatS>
but actually I meant someone who could answer me a question ...
<Taaus>
Well, I can answer your questions... :)
<MegaWatS>
werent you just a beginner like me too?
<Taaus>
Sure.
<MegaWatS>
or do i have you mixed up with someone?
<MegaWatS>
well it cant hurt if I go ahead and describe my problem
<Taaus>
:)
<MegaWatS>
its got to do with polymorphic variants. ...
<MegaWatS>
if I have two types
<MegaWatS>
type foobar = [ `foo | `bar ]
<MegaWatS>
and foobarqux = [ `foo | `bar | `qux ]
<MegaWatS>
why wont the following compile:
<MegaWatS>
let quux x =
<MegaWatS>
match x with
<MegaWatS>
| `foo -> `qux
<MegaWatS>
| `bar -> x
<MegaWatS>
?
<MegaWatS>
it says
<MegaWatS>
This expression has type [< `bar | `foo] but is here used with type [> `qux]
<MegaWatS>
its not REALLY a problem as its kinda easy to work around, it just struck me as strange
<Taaus>
Hmm... Okay... I'll have to expreiment a bit ;)
<Taaus>
Experiment, even.
<MegaWatS>
well to my understanding
<MegaWatS>
[< `bar | `foo] means
<MegaWatS>
that the type is complete
<MegaWatS>
i.e. that it cant accept any more constructors than those given
<MegaWatS>
whereas
<MegaWatS>
[> `qux]
<MegaWatS>
means that the type might still be extended with additional constructors
<MegaWatS>
anc well
<MegaWatS>
and well
<MegaWatS>
something like
<MegaWatS>
let quux x =
<MegaWatS>
match x with
<MegaWatS>
| `foo -> `qux
<MegaWatS>
| `bar -> `bar
<MegaWatS>
works
<MegaWatS>
the type it returns is
<MegaWatS>
as expected
<MegaWatS>
[< `foo | `bar] -> [> `qux | `bar]
<Taaus>
Yeah.. I just tried that :)
<smkl>
i guess [< ] types cannot be unified with [> ] types
<smkl>
ie. the type of x cannot be expanded to include `qux
<Taaus>
If you include `qux in the matching, it works, though... :)
<Taaus>
It compiles, that is ;)
<Taaus>
Works is a completely different matter :)
<MegaWatS>
well actually that is among the nice things about ocaml
<Taaus>
What is? :)
<MegaWatS>
that if it compiles, it most likely works, as well
<Taaus>
Heh, not quite...
<Taaus>
Sometimes you get infinite loops.
<MegaWatS>
heh of course not applied to program logic
<Taaus>
(If your code is bad, that is ;)
<Taaus>
But sometimes, the type can 'warn' you that there's something wrong.
<MegaWatS>
but that if it compiles, it means that the code does what you wrote at least ( which is still not necessarily the same as what you meant )
<MegaWatS>
which is mor than can be said of C, for example
<Taaus>
I.e. I had a function where I expected type int -> int list, but I got int -> 'a list ... That was an infinite loop bug :)
<MegaWatS>
:)
<MegaWatS>
smkl: yeah i figured so much
<MegaWatS>
but: WHY?
<MegaWatS>
i mean
<MegaWatS>
it should be straight-forward, as I understand it
<MegaWatS>
especially if i have a [< ] type that is a subset of a [> ] type ...
<MegaWatS>
but that still doesnt work
<MegaWatS>
ie with explicit type-declaration
<smkl>
dunno. that is probably just because of the type inference algorithm
<smkl>
it is possible to make conversions like let f (x:[<`a|`b]) = (x :> [`a|`b|`c]);;
<MegaWatS>
ah ok
<MegaWatS>
thx
<__DL__>
It's sad i wasn't there. I do have the awnser...
<__DL__>
And i have no idea of when this discution was...
<MegaWatS>
19:57:26] <MegaWatS> thx
<MegaWatS>
about an hour ago
<MegaWatS>
but im still here :)
<__DL__>
The proble come frome the unification of both x (which are the same) :
<MegaWatS>
so you can still answer if you want :]
<__DL__>
in
<__DL__>
let quux x =
<__DL__>
match x with
<__DL__>
| `foo -> `qux
<__DL__>
| `bar -> x
<__DL__>
x have only one type
<__DL__>
so the type of the argument (x) and of the result (x or `qux) must be the same
<MegaWatS>
why must they be the _same_?
<MegaWatS>
i mean
<MegaWatS>
`foo for example
<MegaWatS>
has type
<MegaWatS>
[> `foo]
<MegaWatS>
and can be used in places for
<MegaWatS>
[ `foo | `qux ]
<MegaWatS>
for example
<MegaWatS>
ie assigned to a [ `foo | `qux ]
<__DL__>
yes, but when you make a pattern matching on a polymorphic variant, you say
<MegaWatS>
why cant x be used if it has a type like, [> `foo | `qux], in places that expect [ `foo | `qux | `bar ] ?
<__DL__>
x can be `foo or `bar, but noting else
<MegaWatS>
hmm yes
<__DL__>
so x as type [< `foo | `bar ]
<__DL__>
so the x in the result as type [< `foo | `bar ]
<__DL__>
and `qux is not of this type
<MegaWatS>
hmm i see
<__DL__>
the solution is may be something as :
<__DL__>
match x with
<__DL__>
| `foo -> `qux
<__DL__>
| `bar as y -> y
<__DL__>
then it work...
<MegaWatS>
i still dont get why cant a [< `foo | `bar] be used as a [`foo | `bar | `qux]
<MegaWatS>
even if the type is complete, ie it cant take any more values anymore
<MegaWatS>
one would think that ESPECIALLY in that case it should be possible
<MegaWatS>
eg
<MegaWatS>
a [> `foo | `bar ]
<MegaWatS>
should NOT be possibly assigned to a [ `foo | `bar | `qux]
<__DL__>
the problem come from the fact that it would be realy difficult to make an algorithm to type such expression
<MegaWatS>
ic
<MegaWatS>
ah well it was just more of a curiosity :)
<MegaWatS>
its not really of a problem in my program
<__DL__>
and the type would be very difficult to read (as the polymorphic variant was in the beggining)
<MegaWatS>
heh thx
<__DL__>
in fact, ocaml compute all the type of the right part of the -> and say the type must be egal, and they can be there
<__DL__>
another solution is :
<__DL__>
oh, it doesn't work, nevermind...
<__DL__>
if you have the ocaml src, you could look to the testlabl/mixin.ml file, it's very interesting to see what can be done with poly variant
<MegaWatS>
hah my opengl project is coming along nicely :>
<MegaWatS>
now I can write ocaml code that looks like this: