-
-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design of new Lua API #4362
Comments
What I'd like to see: instead of Versioning: my idea is that each of these objects has an interface version number that defaults to 1, a read-only |
@Mudlet/lua-interface @demonnic @keneanung |
Seems very interesting on first glance! I like a structured approach after 10+ years of growing api components rather organically. Not sure how many % of existing api can be mapped to the suggested classes. Would require scripters learn many new tools or new names for old tools, unless they stay on legacy api. Having two apis simultaneously potentially clutters the auto compete suggestions. |
Having two apis simultaneously also increases support burden, as now we have to support both methods. On top of that, Lua is not really an OOP language. I know we have a lot of what Lua passes off as OOP floating around, but that's not the same as actually being object oriented. Also, it's a mistake to think that most Mudlet users are developers or scripters, or that somehow making a new, fully OOP API would be better just for existing and being OOP. I'm not against wrapping up a lot of our existing functionality into OOP wrappers, or moving to sol3 or any of that, but I also want to make -very- sure this is well thought out and doesn't wind up being a lot of effort for very little gain, or perhaps even a net loss. |
@smurfix would you be able to curate the discussion here - update the OP with all concerns issues and tick them off as we resolve it? |
@vadi2 Sure, can do. |
Summarized the current state of the discussion (and some of my thoughts about it) in the OP. |
I agree with #4362 (comment) in general. Positive about this, but we need to be super sure it's a net benefit. Can we all think on what benefits this brings to users, and once we're super sure of this, think on a good plan to roll this out? |
The main benefit I see is for us so we can be more proactive adding new and expanding old features. The user benefit is new features and less baggage in the documentation. The latest fail of me trying to implement some expanded feature (like Speed: sol3 has a pretty impressive benchmark https://sol2.readthedocs.io/en/latest/benchmarks.html so personally I think that if there's any slowdown just from switching to OO the user won't notice. There's also a chance for speedups, e.g. when you do five things with a room (like add exits) or a console (set colors, background, content) the user only needs to look up the room/console once, not five times, but again I doubt that anybody would notice. Transition: I don't think we need a "hard" transition. We can implement "Console" (or "Room" or whatever) objects, then implement a The "hard transition" thing is an issue if/when we want to switch to a newer Lua version. IMHO the only realistic way to do this is to build both a Lua-5.1 and a Lua-5.4 Mudlet, ask people to please test their code with both, keep that up until everybody agrees that their scripts work with 5.4, then relegate the 5.1 branch to maintainance+serious-bugfix-only status. I'd personally be OK with our new&shiny object-oriented code being Lua-5.4 only, but I'm not most Mudlet users (some of whom probably want to use new OO code and their old scripts), so in general I'm -1 on having one of these transitions depend on the other unless absolutely necessary. We'd have to do some actual experiments with sol3-ifying our codebase to determine whether that approach is viable; the sol3 docs state that it should work but I wouldn't bet a whole lot of money on that actually being true if you do somewhat-more-complicated mappings. |
Get simple accessibility implemented, at least pilot mobile, then work this
in parallel to improving those. If these things are not done, there will
not be a community to serve.
…-Tamarindo
On Mon, Nov 23, 2020 at 6:24 AM Vadim Peretokin ***@***.***> wrote:
1.
We have to think on advantages this brings to the users to sell them
on it, because we will be bringing a lot of pain to everybody by making
them learn a new way of doing things. People will rightfully ask "why
change?" and I feel we don't have enough of good arguments yet. Pretty much
the only reason we're considering a new API is because we, developers, are
feeling the pain. And we don't build Mudlet for ourselves, we build it for
the users, so that's not a good argument.
I can think of just one improvement for users and that is better
discoverability, the lua display(Room) immediately shows everything
you can do with rooms bit, but to rewrite an entire API just for that
is an ungodly amount of work. Users can already do the same by going to
https://wiki.mudlet.org/w/Manual:Lua_Functions and searching for room.
Can we collectively think of more and how will it improve things?
2.
The other thing I'd like to keep in mind is performance - that's not
on the list yet. The C-like binding is super fast, anything we do will be
slower. Can we setup some benchmarks to make sure we don't lose it (much)
in the new object-oriented land?
3.
I think we'd have to keep and expand the old API for a while for the
new features we add until we have *everything* in place ready for a
transition, then give the community a few years in place to transition, and
then freeze the old API in order to keep old scripts working.
4.
Or, we use this as a moment to jump onto the latest Lua version and
break backwards compatibility with old scripts - abandoning scripts that
are no longer updated and leaving users in the dark. Something to think
about.
5.
room.foo = bar is nice and simpler, I agree.
6.
Same with lua display(Room) immediately shows everything you can do
with rooms.
7.
Shortlist of classes. good start!
I agree with #4362 (comment)
<#4362 (comment)> in
general. Positive about this, but we need to be super sure it's a net
benefit. Can we all think on what benefits this brings to users, and once
we're super sure of this, think on a good plan to roll this out?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#4362 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXKUAVLXYMWYODKFXG3SD3SRJBADANCNFSM4TW2HGUA>
.
|
@mpconley What do you mean by "accessibility"? As I understand the term it's all about the user interface, while this thread is about overhauling our Lua bindings. Thus in the context of this issue your comment is somewhat misplaced IMHO. But maybe I just misunderstood what you wrote. |
Yes, having blind people be able to get the game text read to them. It's currently still not working, but requested by many. |
It's about Mudlets accessibility for screen readers, which is very low at the moment since tconsole does not plug into the qt accessibility class. mpconley has done work on this, there's a branch with it available. |
Ah. I am honestly sorry about not having time to work on that in addition to all the other stuff already on my plate. For reference, the a11y issue is #3342 and far from easy to solve. There's some overlap with this issue in that we need to be able to add some hints to our UI elements: tab order, hotkeys, discoverability of links, selecting popup menu items via the keyboard, etc. etc., which strengthens the idea of using a Geyser-style table-based approach to configuring all of them. |
I added a list of TODO items to the OP. Of the class list, |
I like the approach you propose and we can defer the hard 5.4 move for later, that is scope creep, I now realise. Let's try this soft approach of replacing APIs. Want to build tests for the things while at it? :) |
I'd love to add tests, the problem is that all of these require some sort of running Mudlet. Ideally we'd have a test MUD that uploads a test script to Mudlet when you connect to it and then puts the thing through its paces; this in turn would be a whole lot easier if we had a11y. One motivation more for somebody to work on that angle. I've got another idea how to add tests that actually run inside Mudlet but will have to check whether that's feasible. |
We do have tests running inside Mudlet with Busted. If you make a profile that connects to |
Which port? 23 doesn't work. (Source code for these tests?) |
Any port. It should install the run-tests.xml package, from there see the We tried, but haven't yet finished setting up CI to run them automatically: https://github.com/Mudlet/Mudlet/tree/add-busted-in-ci Meanwhile demonnic runs them manually when he reviews PRs. |
Brief summary of issue / Description of requested feature:
The current heap of semi-related functions does not scale any more. We need an object-oriented design that can be used with a mapper like sol3.
Steps to reproduce the issue / Reasons for adding feature:
Expected result of feature
We have a new object-oriented interface with a handful (or two) of classes, each of which has a handful (or three) of methods / attributes.
Issues to be discussed / resolved
Keeping two APIs uptodate is a lot of busy-work.
LuaInterface
and rewrite the old functions in LuaLua 5.4?
Performance
Versioning
How object-oriented do we want this to be?
lua display(Room)
immediately shows everything you can do with roomsEditing, autocomplete
Room
, so if people name their vars intelligently they get a sufficiently-short listOOP vs. procedural coding
setRoomFoo(roomID, bar)
is longer == less memorable thanroom.foo = bar
esp when you only need to get the room once but then set five attributes on it. More expressive code is good.Object Creators
Details
Shortlist of classes.
We need to do a review of
TODO
sol3
to our build infrastructure.The text was updated successfully, but these errors were encountered: