[erlang-questions] [Erlyaws-list] String Support, The most needed feature

orbitz <>
Sat Mar 3 21:54:24 CET 2007


I'm not sure if Erlang is necessarily lacking anything in the string  
department, but the problem is probably based more around how to  
actually deal with strings.  In many popular language (not Haskell  
has the same concept of strings that Erlang does, for the most part),  
accessing an element of a string is O(1) but in Erlang it is O(n). To  
me this means that when you do things with strings you are generally  
going to have to do them in terms of tail ends.  What I mean by this  
is in Python you mind do idx = mystring.find(foo)  And you get an idx  
and go there and work with it.  In Erlang this would become mylist =  
find(mystring, foo), and find would return the remaining list so you  
can work across the string.
This has the most obvious problem of not allowing you to go backwards  
through the string, so you can't find things prior to some landmark  
you are working for.

That said, I do sometimes think perhaps a container that has O(1)  
random access time might be nice in Erlang.  In Haskell we have Array  
which works wonderful for those situations.  In Erlang the closest we  
have is a Binary which is limited to bytes as far as I can tell so I  
wouldn't call it a true container.

So the conclusion I'm trying to reach is, Erlang doesn't need a  
string layer, it needs a new container for these kind of situations.


On Mar 3, 2007, at 2:39 PM, CyBerHigh wrote:

>
>
> On 3/3/07, Martin Logan <> wrote: What  
> exactly did you find so difficult that it was easier to reinvent
> one of the major benefits of Erlang with Python rather than to suffer
> through that element of string handling?
>
> On 3/3/07, CyBerHigh < > wrote:
> > This is my own personal view of erlang.
> >
> > Erlang is going to be left far behind because it is liking only  
> one feature,
> > true String support.  All modern languages have an abstraction  
> layer over
> > strings except for erlang.  If you want to have a popular  
> language you need
> > it.  I love every feature of erlang and its coding style but I  
> hate the fact
> > that I cannot handle strings very easly and that strings take up  
> huge
> > amounts of memory.  In fact I was attempting to user erlang for  
> my project
> > but found that handling strings was so much work that it was  
> easier to use
> > other languages like python with stackless then create my own rcp  
> interface.
> >  Which is now pretty similar to erlang without all the nice  
> coding styles of
> > erlang.
> >
> > Is there any movement to create a better string interface?  Cause  
> I would
> > love to come back to erlang and use it and get the name out there  
> more than
> > it is currently but untill there is such a thing I just can't  
> find myself
> > using it.
> >
> > Thank you
> > CyberHigh
> >
> >  
> ---------------------------------------------------------------------- 
> ---
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to  
> share your
> > opinions on IT & business topics through brief surveys-and earn cash
> > http://www.techsay.com/default.php? 
> page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > Erlyaws-list mailing list
> > 
> > https://lists.sourceforge.net/lists/listinfo/erlyaws-list
> >
> >
>
> Python is very good with string.  In fact I enjoy its string syntax  
> more than perl and other string processing languages.  I am not  
> actually reinventing anything, stackless offers message passing and  
> microthreads just like erlang.  I am moving to a more erlang style  
> of code but doing so is not requiring much work.  I just feel there  
> is no reason why I need to actually think of a string as a list of  
> characters, unless I am in c.  It is nice that I don't need to have  
> end of string characters but I feel that elangs biggest short  
> coming is the fact that strings are not the easiest thing to  
> handle.  Erlang should be able to act like a string processing  
> language, offering easy to use things like regular expressions  
> quick split operations and other nice string tools.  Just seems  
> like that would be a big priority to be able to compete with all of  
> these new languages popping up and are started to implement  
> erlang's good things.  Python is even started to get a on-the-fly  
> programming model which erlang has.  Plus there are tools to be  
> able to do it in just about any popular language now a days.  So  
> the list of things that erlang has that others don't is becoming  
> short.  Erlang still seems to have it implemented better than other  
> languages, but it missing string handling capability's that other  
> languages do so well that they almost make up for the erlangs  
> slight betterment of implantation.
>
> Is there something I am missing about erlangs string capability's,  
> or is there a movement to add better methods to erlang?
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list