help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: open socket with listen() and still have command line available?


From: Tom Holroyd (NIH/NIMH) [E]
Subject: Re: open socket with listen() and still have command line available?
Date: Wed, 30 May 2007 14:18:47 -0400
User-agent: Thunderbird 1.5.0.10 (X11/20070301)


Paul Kienzle wrote:

On May 27, 2007, at 11:49 AM, Tom Holroyd (NIH/NIMH) [E] wrote:

Hmm... that still leaves the send/recv function in parallel which will conflict with the posix socket interface.

Is there no way to implement namespaces?

Something like this needs to be done sometime.

pkg load socket
send(blah)
pkg load socket as skt
skt.send(blah)

We could get this sort of functionality with a new octave type 'module'.

Why not just use struct()? Let's say I'm defining a package called moo in 
/tmp/moo:

---8<---
function b = f(a) b = a + 2;
end
function b = g(a) b = a + 3;
end
# emulate package being loaded as
# pkg load moo as moo
moo = struct("f", @f, "g", @g); clear f clear g ---8<---

Then I can do:

octave:1> source('/tmp/moo')
octave:2> moo.f(4)
ans =  6
octave:3> moo.g(4)
ans =  7
octave:4> f
error: `f' undefined near line 4 column 1

where I am using the "source" command above as a replacement for "pkg load moo as 
moo".

--
Tom Holroyd, Ph.D.
"The fundamentally misconceived nature versus nurture debate should be
abandoned: child development is inextricably both." -- Louann Brizendine


reply via email to

[Prev in Thread] Current Thread [Next in Thread]