det has quit [Read error: 60 (Operation timed out)]
Snark has quit [Read error: 110 (Connection timed out)]
monotonom has quit ["Don't talk to those who talk to themselves."]
debona|r has joined #ocaml
vezenchio has joined #ocaml
Snark has joined #ocaml
smimou has joined #ocaml
Banana has quit ["Reconnecting"]
Banana has joined #ocaml
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
Demitar has quit [Read error: 104 (Connection reset by peer)]
demitar_ has joined #ocaml
<mflux>
jason__, ocaml strings are always 0-terminated for c-compatibility, however ocaml itself stores the length of the string and uses that
FredCods has quit [Read error: 110 (Connection timed out)]
<jason__>
Yeah.. It's not getting terminated for some reason in the native compilation.
<jason__>
It is in the VM one though.
<jason__>
It's weird.
<jason__>
Well.. "print_string" prints out the extra characters in the buffer.
<mflux>
I suppose you haven't compiled it with -unsafe
<jason__>
No.
<jason__>
What is -unsafe?
<jason__>
No bounds checking?
<mflux>
yep
<jason__>
I don't get a segfault or anything.
<jason__>
I'm reading these buffers over a socket though.
<mflux>
missing boundaries doesn't necessarily imply a segmentation fault ;)
<jason__>
It's possible the C termination isn't sufficient for print_string to qualify as a real terminator.
<mflux>
I believe ocaml itself doesn't use the zero termination for anything
<mflux>
but instead the length
<jason__>
Yeah.
<jason__>
Hm.
<jason__>
Maybe I need to set the length to the offset read.
<jason__>
Like, the string buffer is 400 characters, but it only has four characters and then a null termination read over the socket.
<jason__>
Then I print it, and it prints that buffer and all of the crap after it.
<mflux>
oh, so you're getting some old data too
<jason__>
Yeah.
<jason__>
I'm trying to make a proxy.
<mflux>
well that's exactly what one'd expect ;)
<jason__>
So I really just want to copy the buffer from one socket to another.
<jason__>
They don't seem to be being copied over exactly using a string.
<jason__>
I believe read and write and thread safe too.
<jason__>
They used to be in the Thread library, but were moved to Unix.
<mflux>
I doubt in that case they are little more than wrappers to unix calls, I can't see why they wouldn't be thread safe
<jason__>
Like, the client sends a random confirmation string to the server, and then the server replies with a string specific to the one given. The client will then react normaly. For some reason the confirmation fails with my proxy.
<jason__>
Almost everything else works fine though.
<jason__>
I think I need to look at the entire composition of the buffer.
<mflux>
a network sniffer might be a useful tool too
<jason__>
Yeah, just tcpdump.
<jason__>
Well, the logic I wrote seems to work.
<jason__>
I wrote a cool tcpsocket object that you construct with a hostname and a port number, and then you can write to it, or iterate over it using a "eachBlock" method that takes a function that takes type string.
<jason__>
And then a tcpserver socket that takes a port, and then has an accept method that will return a tcpsocket instance for the client that connected.
<jason__>
So, the actual proxy is maybe four lines of code.
<jason__>
Hehe.
<mflux>
there are tools more suitable for sniffing streams than tcpdump ;)
<jason__>
Oh? What?
<jason__>
Hehe.
<jason__>
I'm used to tcpdump.
<mflux>
sniffit, ethereal
<mflux>
tcpflow
<jason__>
Hm.
<mflux>
ethereal (and it's companion tethereal) is especially something worthwhile to check out ;)
<jason__>
What is tethereal?
<mflux>
it's a text version of ethereal. similar to tcpdump.
smkl has quit [Read error: 113 (No route to host)]
kinners has joined #ocaml
jason__ has quit ["Client Exiting"]
kinners has quit [Read error: 110 (Connection timed out)]
FredCods has joined #ocaml
demitar_ is now known as Demitar
cjohnson has joined #ocaml
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
mattam_ is now known as mattam
pattern has quit [Connection timed out]
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
GreyLensman has joined #ocaml
pattern has joined #ocaml
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
Snark has quit [Read error: 110 (Connection timed out)]
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
menace has joined #ocaml
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
maihem has joined #ocaml
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
Tachyon76 has joined #ocaml
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
cjohnson has quit [Remote closed the connection]
lmbdwar has joined #ocaml
monotonom has joined #ocaml
ionOSu has quit [Read error: 104 (Connection reset by peer)]
cjohnson has joined #ocaml
ionOSu has joined #ocaml
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
lmbdwar has quit ["No windows for this server"]
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
ionOSu has quit [Remote closed the connection]
cjohnson has quit [Success]
Snark has joined #ocaml
cjohnson has joined #ocaml
cjohnson has quit [Success]
vincenz has quit [Remote closed the connection]
vincenz has joined #ocaml
cjohnson has joined #ocaml
whee has joined #ocaml
vincenz has quit [Remote closed the connection]
vincenz has joined #ocaml
vincenz has quit [Remote closed the connection]
vincenz has joined #ocaml
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
ionOSu has joined #ocaml
Tachyon76 has quit [Read error: 54 (Connection reset by peer)]
Tachyon76 has joined #ocaml
demitar_ has joined #ocaml
Demitar has quit [Read error: 54 (Connection reset by peer)]
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
Riastrad1 has joined #ocaml
Riastradh has quit [Nick collision from services.]
Riastrad1 is now known as Riastradh
pac_away has joined #ocaml
Tachyon76 has quit [Read error: 60 (Operation timed out)]
cjohnson has quit [Remote closed the connection]
Tachyon76 has joined #ocaml
cjohnson has joined #ocaml
whee has quit []
whee has joined #ocaml
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
Riastrad1 has joined #ocaml
pac_away has quit ["leaving"]
Riastradh has quit [Nick collision from services.]
Riastrad1 is now known as Riastradh
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
buggs|afk has joined #ocaml
yauz_ is now known as yauz
cjohnson has quit [Remote closed the connection]
Tachyon76 has quit [Read error: 60 (Operation timed out)]
demitar_ is now known as Demitar
buggs has quit [Connection timed out]
mattam_ has joined #ocaml
pac_away has joined #ocaml
monotonom has quit ["Don't talk to those who talk to themselves."]
mattam has quit [Read error: 110 (Connection timed out)]
Tachyon76 has joined #ocaml
Snark has quit [Remote closed the connection]
Snark has joined #ocaml
Snark has quit ["Parti"]
whee has quit []
efficxpert has joined #ocaml
efficxpert has left #ocaml []
efficxpert has joined #ocaml
Demitar has quit [Read error: 110 (Connection timed out)]
Riastradh has quit ["Changing server"]
Riastradh has joined #ocaml
Riastradh has quit [Nick collision from services.]
Riastradh has joined #ocaml
Demitar has joined #ocaml
Tachyon27 has joined #ocaml
efficxpert has quit ["Leaving"]
Tachyon76 has quit [Read error: 110 (Connection timed out)]
gim has joined #ocaml
vezenchio has quit ["With little power comes little responsibility"]
pac_away has quit ["leaving"]
jason_ has quit ["Client exiting"]
jason_ has joined #ocaml
ionOSu has quit ["Leaving"]
matkor has joined #ocaml
jason_ has quit ["Client exiting"]
bk_ has joined #ocaml
Tachyon27 has quit [Read error: 110 (Connection timed out)]
jason_ has joined #ocaml
aum has joined #ocaml
<aum>
hi - anyone here?
<mellum>
yes, at least you.
<aum>
i've been hacking in python and forth, just taking a first look at ocaml
<aum>
i gather that ocaml can produce standalone executables (eg, .EXE files for window$ )
<jason_>
So can python.
<jason_>
And, yes.
<aum>
python's standalone EXEs are a tad bloated - at least 1MB for a hello,world
<jason_>
Yeah, but that's a base size.
<aum>
when an ocaml file is compiled to native binary, does this binary just embed a vm (as with python)?
<jason_>
A more sophisticated program wouldn't be much larger.
<jason_>
No.
<jason_>
It's a native implementation.
<aum>
great
* aum
is a bit frustrated with python's bloat and slowness
<jason_>
Python isn't slow really.
<jason_>
I'm not sure what you mean by bloat.
<mellum>
jason_: depends on what you're doing
<aum>
is it easy to implement c extensions to ocaml?
<menace>
lol
<jason_>
Yes.
<jason_>
Take a look at "swig".
<mellum>
jason_: I'm not sure you'll have fun writing a MPEG4 decode in Python, for example.
<aum>
swig == hell
<jason_>
mellum: True, still.
<jason_>
Hm, if you find swig complicated, you're going to find Ocaml a lot more complicated.
<jason_>
Did you place ocaml on your system yet?
<aum>
i've written a heap of python, and have wrapped several C libs for python using 'pyrex'
<aum>
jason_: just downloaded ocaml
<jason_>
Do you have cygwin?
* aum
runs debian
<jason_>
You asked about native win32 executables, so I assumed you were running windows.
<aum>
what's cygwin? :P
<aum>
well, i've got windows in a vmware box
<jason_>
Cygwin is a redhat implementation of libgcc.
<aum>
i do all my development on debian, then build exes for windows
<jason_>
Like, a linux environment for Windows.
<aum>
does ocaml on windows require cygwin?
<jason_>
Probably can be built using Visual C++.
<jason_>
I use gentoo, so I'm not really certain about the specifics.
<jason_>
Well, type "man ocamlopt" if you want to know more about the native code compiler.
<aum>
hmm, the ocaml q&a says there's native win32 and cygwin win32 ports of ocaml
<jason_>
Right.
<jason_>
cygwin is native as well.
<jason_>
It just is uses gcc.
<aum>
and requires a 1MB DLL
<jason_>
Ocaml requires a 1MB DLL?
<aum>
no, cygwin does
<jason_>
Probably a compilation of all of the libgcc shared objects.
<jason_>
Tried hello world in Ocaml yet?
<aum>
still reading
<jason_>
It's a functional language, and it has a garbage collector associated with it, not to mention it's more standard than C. So, the executables tend to have a great deal more symbols than your average C compiled executable.
<jason_>
But, it has far less stack variables
<aum>
k
<aum>
how's it go for speed
<aum>
?
<jason_>
About as fast as C, faster than C++.
<Riastradh>
You won't be concerned in that regard.
<jason_>
Depending on what it's doing.
<jason_>
I tend not to compile to native, the virtual machine is nearely as fast as compiled C++.
<jason_>
At least with my experiences.
<aum>
just looking at a shootout website - ocaml is beaten only by C for speed
<mellum>
The optimizer is not very clever, though. The compiler basically does what you tell it.
<jason_>
Weight everything the same, and C/Ocaml/SML tie.
<jason_>
Right, but the language by default doesn't use stack variables where they aren't needed.
<mellum>
jason_: stack variables?
<jason_>
mellum: let bob = 5 in doSomething bob;
<aum>
jason_: right you are - c/sml/ocaml tie
<jason_>
mellum: You don't need to allocate a mutable position on the stack inside that method.
<aum>
does ocaml do class/object introspection?
<mellum>
jason_: you don't need in any other language, either.
<mellum>
jason_: so? Why would any stack access be involved with that?
<jason_>
You're going to store that temporary value in a stack variable in an imperitive language, where you'd just have it replaced in a let statement.
<jason_>
mellum: Because int myVal is allocated on the stack inside the function bob.
<mellum>
jason_: If the compiler was made after 1975, it has this new-fangled "register allocation"
<jason_>
mellum: Strange that I can calculate the location of the return address exactly by adding up the sizeof variables in the function.
<jason_>
mellum: In a more complicated example, it's certainly going to get stack allocation, and it's going to be mutable. In Ocaml it's simply replaced with the value.
<mellum>
jason_: location of the return address? You must be using an ancient architecture; all modern ones pass return addresses in a register
<jason_>
mellum: GCC doesn't.
<mellum>
jason_: it very definitely does.
<Smerdyakov>
GCC doesn't _on_the_x86_.
<jason_>
I'm not sure about these "modern" ones.
<jason_>
mellum: You've heard of a "buffer overflow" before, right?
<Smerdyakov>
Which is the gimped-out king of shitty architectures.
<jason_>
Neither does Visual C++.
<mellum>
Well, x86 clearly falls under "ancient".
<Smerdyakov>
jason_, do you understand? This is a feature of the architecture, x86, which is out-of-date. These compilers do what is reasonable with what the architecture allows.
<jason_>
It's stack allocated. And it doesn't matter if it's passed in a register either, it's still passed.
<jason_>
Smerdyakov: Yes, I understand that he's maybe reffering to machines that .01% of the population uses.
<Smerdyakov>
jason_, hardly true. x86 is a tiny portion of computers in use today.
<Riastradh>
Smerdyakov, what machines do you typically use?
<Smerdyakov>
I don't know about the machines hidden in all sorts of gizmos around me.
<jason_>
Smerdyakov: You've got to be kidding me if you actually believe that's true.
<Smerdyakov>
I've always used x86 for PC stuff, but that is far from dominating the world of computers.
<Smerdyakov>
jason_, this is actually completely obvious and accepted....
<jason_>
How is this obvious?
<Smerdyakov>
jason_, through the slightest investigation of where computers are used today.
<Smerdyakov>
That is a very small portion of the market.
<mellum>
Well, IIRC, last year about 800 million ARM processors were sold.
<Smerdyakov>
mellum, is ARM x86?
srv has quit [""reboot serveur""]
<jason_>
I'm not talking about Mobile Phones.
<Smerdyakov>
jason_, why aren't you?
<jason_>
And ARM isn't an x86 architecture.
<mellum>
Smerdyakov: no.
<Smerdyakov>
jason_, are you saying you're excluding mobile phones from counting as computers?
<jason_>
Yes, I am saying that.
<Smerdyakov>
That's an odd thing to say about a kind of computer that will be more common than PC's soon, if it isn't already.
<aum>
but with nowhere near the capacity of the pc (yet)
<jason_>
Well, in general, if you say the word "Computer" to a person, they're going to think of a PC.
<jason_>
If you say the word "Mobile Phone" to a person, they're going to associate that term with a Mobile Phone.
<jason_>
Lol
<Smerdyakov>
jason_, that's what a "non-technical" person will think. We're generally more on top of things here.
* aum
imagines the future: "man, i so gotta upgrade my cellphone, how do I put up with this ancient thing with only 5.6GHz processor, 4GB RAM, 1GB/s WLAN"
<jason_>
And I suppose when they put a computer chip in your toaster, that will suddenly become a "Computer" as well.
<Smerdyakov>
jason_, absolutely.
<Smerdyakov>
jason_, this is the accepted meaning of the term.
* aum
imagines toasters with a CPU and software that will only cook certain brands of bread, and hacking the toaster breaches the DMCA
srv has joined #ocaml
<jason_>
Well, then, we are simply communicating in a incorrect manner. When I made the statement that most computers use x86 based processors, I meant a computer with a keyboard, a mouse etc..
<Smerdyakov>
How dull. :P
<jason_>
It may be, but morphing what my statement means will get us nowhere :) I'm simply making it clear.
<mellum>
Anyway, my point was that using the stack in the C function you mentioned is the result of a crappy architecture, not of a crappy language or compiler.
<jason_>
Using storage for a value that could be determined by the compiler is the product of a crappy language.
<Smerdyakov>
Not if the value is expensive to compute and is used multiple times
<jason_>
It's only computed once, in the let statement.
<jason_>
Or "expression" before you go off on that rant :P
<jason_>
So, mellum, what type of computer are you using at the moment?