ULX

Author Topic: ULX priorities  (Read 3308 times)

0 Members and 1 Guest are viewing this topic.

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
ULX priorities
« on: April 09, 2015, 11:29:23 AM »
Was just chasing an issue down with URS and noticed some changes to ULib (which I haven't pulled from Github yet).  Am I right when I say it looks like you've reduced the priorities from -20 through 20 to -2 through 2?  This limits the granularity that was available in terms of making sure certain hooks get run before others.  Was this a change for performance reasons?

Thanks.

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: ULX priorities
« Reply #1 on: April 09, 2015, 11:37:24 AM »
Ugh... I'm really confused. It looks like -2 and 2 are now the read-only priorities.   It also looks like Ulib is clamping priorities > 2 and < -2 to 2 and -2 respectively.  This means (if I'm right, which I'm probably not), that legacy hooks that used, say a -10 priority and were NOT read-only will become a -2 and read-only.  This seems like it'll break any addon that uses priorities beyond -2 through 2 and expects to return a value that's honored by the hook chain.

« Last Edit: April 09, 2015, 11:47:12 AM by Buzzkill-THABB »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX priorities
« Reply #2 on: April 09, 2015, 03:52:54 PM »
Yes, they've changed.
I didn't go read our latest (team only) design docs to fully understand how or why to answer your range questions and will have to let SticklyMan or Megiddo answer those (or perhaps MrP if he's been keeping up).
I do know we're looking to get our hook priority system into Gmod.
Though Stickly Man's posted that general info a few various chat areas, he mentioned it in a conversation you started in this post
If you are using the latest SVN of ULX/ULib, we've changed hook priority to be a set of constants, so you'd want to use HOOK_MONITOR_HIGH and HOOK_MONITOR_LOW for better results. :)  (Also, we're petitioning to get this hook library implemented in Garry's Mod by default... hopefully)

I figure DbugR distracted you there. :)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: ULX priorities
« Reply #3 on: April 09, 2015, 04:02:47 PM »
Got it -- yes, I understand they've changed.  When I first posted I was sensing an issue that I clarified a bit more in my second post.  It looks like the new implementation is poised to break some functionality.   For example, a current -10 read/write hook will get clamped to a -2 read-only hook. This can be mitigated somewhat (I posted a ticket to GitHub), but there are still some nasties that can't be coded away.  For example, anyone unfortunate enough to have used -2 or 2 as a hook priority in legacy code and expected to be able to issue a return from their function will be stuck in limbo (the hook will be read-only with no way of sensing the true intention).

I realize not every legacy edge case can be incorporated into backward compatibility, and I may be pointing out things that were addressed and dismissed long ago.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: ULX priorities
« Reply #4 on: April 09, 2015, 04:30:25 PM »
I've been dealing with the aftermath of the hook changes for quite some time haha... example... https://github.com/Aaron113/urs/issues/21

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: ULX priorities
« Reply #5 on: April 09, 2015, 04:35:00 PM »
psst.. ascentechit = me.  :) 

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: ULX priorities
« Reply #6 on: April 09, 2015, 04:37:11 PM »
Heh, either way both of you seemed to have issues with the hook priority stuff.

EDIT:  And you're not the first.
« Last Edit: April 09, 2015, 04:39:08 PM by Aaron113 »

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: ULX priorities
« Reply #7 on: April 10, 2015, 12:02:40 PM »
Is there any way to get ULib's hook table?  I'm looking through shared/hook.lua, and it looks like we override GetTable() to return the legacy (pre ULib) table.  I'd like to interrogate the current hook table from ULX in order to build a utility function to return all active hooks and their priorities, but I don't see how I can get at Hooks from outside hook.lua.

Thanks.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX priorities
« Reply #8 on: April 10, 2015, 05:08:38 PM »
You can read more on the issue here -- https://github.com/Nayruden/Ulysses/issues/448

Buzzkill, our intent is to propose the ULib hook module as the official hook module going forward (GetTable() would change to return the regular table at that time), but I've added GetULibTable() to hook.* in the meantime.
Experiencing God's grace one day at a time.

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: ULX priorities
« Reply #9 on: April 11, 2015, 08:02:17 AM »
Thanks Megiddo!

BTW -- that ascentechit fellow is incredibly insightful and well-spoken.

 ;D