Quantcast

String data type

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

String data type

Mickael Remond-2

Hello,

Some times ago, the Erlang people talked about adding the string type into the
Erlang code.
Is this still something that are interesting the OTP people ?

This type would be needed by some of our project and I was thinking that maybe
we could help on those aspects

Do you have any idea on how to do it ?
Do you know how hard it would be ?

Thank you in advance for your support.

--
   Micka?l R?mond                    tel :      (33)1.44.42.00.00
   Projet Manager                    mob :      (33)6.60.22.22.16
   15 - 17 avenue de S?gur           e-mail :   mickael.remond
      75007 - Paris                  web :      http://IDEALX.com


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

String data type

Robert Virding-4
Mickael Remond <mickael.remond> writes:

>
>Hello,
>
>Some times ago, the Erlang people talked about adding the string type into the
>Erlang code.
>Is this still something that are interesting the OTP people ?
>
>This type would be needed by some of our project and I was thinking that maybe
>we could help on those aspects
>
>Do you have any idea on how to do it ?
>Do you know how hard it would be ?

The first question is of course what do you *mean* by a string
datatype?  What type of operations do you intend to do on these
strings?

Binaries provide efficient storage of bytes and with the new bit-syntax
you also get quite a good interface to access binaries.  There are some
things to watch when building but otherwies it works well.  However
there are not many libraries to do the same type of operations on
binary strings as for normal list strings.

One thing to remember though is that most of the low-level i/o modules
and functions also accept lists of bytes and binaries for output so it
is practical to use different handling for different parts of a message.
For example I can pull apart a binary message, process the wrapper, pass
the data straight through as a binary and recombine it on output with a
new wrapper.

        Robert




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

String data type

David Gould-2
On Fri, Feb 16, 2001 at 12:37:19PM +0100, Robert Virding wrote:

>
> The first question is of course what do you *mean* by a string
> datatype?  What type of operations do you intend to do on these
> strings?
>
> Binaries provide efficient storage of bytes and with the new bit-syntax
> you also get quite a good interface to access binaries.  There are some
> things to watch when building but otherwies it works well.  However
> there are not many libraries to do the same type of operations on
> binary strings as for normal list strings.

I want to have the normal libraries or similar to work with binary strings.
That is, I want regexs (eg perlre), spit, join, getline, upcase, str, but
do not want to pay the size and time penalties for making lists out of
strings. I would really prefer to use Erlang for all those text munging,
and report building and scripty things that perl does so very well, but
when you need to rip apart hundreds of megabytes of text, the time and
space penalties of the list representation are too much.

On the topic of: "what else could Erlang have to be a better general purpose
tool?", it would be nice to have a mode or an interpreter start file or
whatever to make it possible to use Erlang from the shell as easily as perl
or pythong scripts. That is, an interpreter behaviour somewhere in between
the normal erl node and the SAE link everything yourself tool. That is, if I
have a foo.erl source, I want to be able to put "#!/usr/local/bin/erlang" at
the top, and then invoke it simply as "./foo.erl -opts somefiles" and have
the language take care of compiling and loading the other modules etc
as needed. Maybe this could be a -behavior(script) or something.

-dg

--
David Gould                davidg               510 536 1443
If simplicity worked, the world would be overrun with insects.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

String data type

Andi Kleen
On Fri, Feb 16, 2001 at 02:23:55PM -0800, David Gould wrote:
> I want to have the normal libraries or similar to work with binary strings.
> That is, I want regexs (eg perlre), spit, join, getline, upcase, str, but
> do not want to pay the size and time penalties for making lists out of
> strings. I would really prefer to use Erlang for all those text munging,
> and report building and scripty things that perl does so very well, but
> when you need to rip apart hundreds of megabytes of text, the time and
> space penalties of the list representation are too much.

Instead of ugly regexprs SNOBOL like pattern matching for text would be neat,
if you want efficient text manipulation. It would lead Erlang a bit back to
its Prolog heritance.


-Andi



Loading...