Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > You dream API for a text editor

Reply
Thread Tools

You dream API for a text editor

 
 
Charles Roper
Guest
Posts: n/a
 
      02-25-2010
Hi Friends,

I am doing a bit of research for a project I am helping out with - a
text editor - and the following question has been asked: what would your
dream API look like and be capable of? Obviously, the API will be
scriptable via Ruby.

I'd be very interested to hear what you guys think.

Many thanks,
Charles


 
Reply With Quote
 
 
 
 
Marc Weber
Guest
Posts: n/a
 
      02-25-2010
Hi Charles,

Jedit can be scripted in various languages. I bet they have JRuby
support.

Vim can be scripted in Ruby.

I don't know about Eclipse.

Writing an editor is a non trivial task.

And I would not ask what API do you dream of.
I'd ask: Which features do you need and how to get them.

Marc Weber

 
Reply With Quote
 
 
 
 
Charles Roper
Guest
Posts: n/a
 
      02-25-2010
Hi Mark,

Thanks for the reply.

On 25/02/2010 08:53, Marc Weber wrote:
> Jedit can be scripted in various languages. I bet they have JRuby
> support.
>
> Vim can be scripted in Ruby.


Are you saying these offer model API's that we should take a look at? I
already know Vim is a strong influence on the project. RedCar also
offers scripting via Ruby.

> Writing an editor is a non trivial task.


Agreed.

> And I would not ask what API do you dream of.
> I'd ask: Which features do you need and how to get them.


The features are already there - this isn't a new editor. What we're
doing is looking at how to make the editor flexible, extensible and fun
as possible without requiring folk to hack on C++. But this isn't about
the editor itself, as such, but rather about the API: what do people
feel makes a great API for a text editor. Or, put another way, what are
the strengths/weaknesses of other API's, Ruby or not, you may have used.

Cheers,
Charles

 
Reply With Quote
 
Marc Weber
Guest
Posts: n/a
 
      02-25-2010
Hi Charles,

your trying to please everyone. This is not going to work (IMHO).
http://en.wikipedia.org/wiki/Comparison_of_text_editors

Here is a list. You can join all mailinglists and ask people what they
like and dislike. Or join their irc rooms.

Eg Vim is a great editor. I'd even say perfect if it wasn't bad at
talking to external processes. (I'm going to fix this though..)
Also the default Vim scripting language VimL isn't very fast.
Keep in mind that it was invented before Ruby, Python etc existed.
At at that time it was very cool.

> as possible without requiring folk to hack on C++.

The big question is: Why do they start hacking at all?
What features are they missing?

Eg I prefer using vi keys over nice API's because they make me
productive every day.

Good luck - I don't think I can help you any further - I told you what
is important to me.
Marc Weber

 
Reply With Quote
 
Charles Roper
Guest
Posts: n/a
 
      02-25-2010
On 25/02/2010 09:53, Marc Weber wrote:
> Good luck - I don't think I can help you any further - I told you what
> is important to me.


Thanks, it's appreciated.

 
Reply With Quote
 
David Masover
Guest
Posts: n/a
 
      02-26-2010
On Thursday 25 February 2010 02:23:33 am Charles Roper wrote:
> I am doing a bit of research for a project I am helping out with - a
> text editor - and the following question has been asked: what would your
> dream API look like and be capable of? Obviously, the API will be
> scriptable via Ruby.


First, make a low-level API. Then, join us in trying to build a "dream API" on
top of that.

I'm not sure what it would look like, I have no idea what it's like to hack on
a text editor. I'd say, let's look at the capabilities you have now, build
that low-level API, and document everything, then we can start to talk about
how you might improve it.

As for that higher-level API...

You may want to brush up on some Ruby idioms. For example, Ruby tends to
support the more flexible idiom of returning an object representing some sort
of handle in a longer operation (like reading a file or looping over a list):

file = open 'foo'
line = file.readline
file.close

That's needed in order to have full functionality, but we also expect tricks
like this:

open 'foo' do |file|
file.each_line do |line|
...
end
end

(Note: The 'file' variable is identical in both cases, it's just that the loop
automatically handles closing the file for us, probably ensuring it happens no
matter what kind of exceptions are thrown, etc.)

The same works for generating output. Look at Builder, Erector, etc, for some
examples of how that can look.

So without knowing your editor's capabilities in detail, and without ever
programming an editor, I don't really know. You'll at least want to provide a
low-level API, in case people disagree with your approach, or in case someone
else comes up with a better idea. But if you want a higher-level API,
something that'll blow us away, something like Hpricot but for text editors...
That takes artistry.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C++11 Variadic Templates: Format("I %%% about %%% of%%%","dream", 7, 9) == "I dream about 7 of 9" Andrew Tomazos C++ 9 12-03-2011 06:35 AM
C++11 Variadic Templates: Format("I %%% about %%% of %%%","dream", 7,9) == "I dream about 7 of 9" Andrew Tomazos C++ 0 11-28-2011 12:02 PM
ZC Dream Photo Editor is better. fastmind@qq.com Digital Photography 3 11-29-2007 06:58 AM
ANN: New low-cost XML Editor, XSLT Editor, XSLT Debugger, DTD/Schema Editor Stylus Studio Java 0 08-03-2004 03:53 PM



Advertisments