Some Erlang problems

Joe Armstrong (AL/EAB) <>
Tue Jan 31 11:46:31 CET 2006


Hello,

Here are some Erlang problems.

Now each of these problems has at some stage been solved - since I have
seen
the solutions - the problem is that the solutions are either
not-maintained, or
have totally degenerated to the point where they are unusable, or the
code has
just mysteriously vanished.

They are the kind of problem that I need solutions to every day, but
take more than
30 minutes to hack together, so often don't get done. They are not
*very* difficult
but they do require a certain familiarity with the system. They also
don't get done
because to solve them would interrupt the flow of what I'm working on,
so I tend to
program around them, rather than stop what I'm doing and solve them.

<< these fall into the funny category of nice to have stuff that never
gets done,
     essential-but-difficult stuff (compilers, run-time, GC) gets done,
     trivial stuff gets done, but this stuff gets missed >> 

I'd like to make a list of such problems, and I'll publish the list at
regular intervals
and the best known solutions.

To help with this I'd like you to send me either a problem, or a
solution to the problem,
I will try to test all solutions, and I will publish all of this in some
form.

For each new problem I'd like a one line summary and a description of
the problem.

Here's my starter list:

1. How do I read raw characters in the shell in live-no echo mode?
2. How do I start an xterm from Erlang, with raw character input/output?
3. How do I trace a sequential program?  

Description:

1)  How do I read raw characters in the shell in live-no echo mode?

I want to do live keyboard input in the shell. I want to be sent a
message
every time there is a keyboard event. This should be at different levels
of granularity (ie I might want to get key-up key-down events, or merely
key-pressed events - I want to control echoing). I want to issue control
codes
for cursor addressing. 

Typical applications read passwords, full screen editor with explicit
cursor control.

Can this be done in the Erlang shell at all?

2. How do I start an xterm from Erlang, with raw character input/output?

This is a generalisation of 1) - I'd like to say Pid = xterm:start() and
a new xterm would pop up - then I should be able to get keyboard events
from the xterm and write raw character to the xterm. I'd also like
keyboard resize events.

Applications - write your own editor (I have a pico emacs that would
work if
anybody can provide the xterm)

3. How do I trace a sequential program?  

Is there an *easy* way to just trace a sequential bit of code, like in a
Prolog debugger.

I'd like to say

	> trace(Mod, Fun, [Args])

And then see a Leap-Trace-Back style debugger interface

The entry point to each function should be displayed. I am given the
options
of Leaping to the next function call, or return value, or Tracing into
the function

I should also be able to go back at any stage. If I lept to a return
value and the return
value was wrong, I'd like to go back one step and retry with a Trace
instead of a leap.

Cheers

/Joe


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060131/3c653bd8/attachment.html>


More information about the erlang-questions mailing list