This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
4006
The Pub / Re: Context object?
« on December 23rd, 2012, 04:06 PM »
Nope, remember... we::$var is 60% slower than $var, while we::get('var') with function get ($v) { return self::$$v; } or something like that would be something like 1000% slower... So it's definitely better to use method static variables than functions to retrieve a variable that's not within our scope.
Other than that, I'd like to know if any of these ideas made sense to you... ;)
Other than that, I'd like to know if any of these ideas made sense to you... ;)
4007
The Pub / Context object?
« on December 23rd, 2012, 11:26 AM »
I'd also like to create a cx (context) object. Not with the usual 'we' prefix, I know, but the idea is to keep it very, very short, and 'we' is already taken for the system class, although we MIGHT be able to use 'we' instead and just have we::$user behave like if it is was $context['user'], or whatever.
The main problems are:
1/ Performance. $context is used in TONS of areas, including time-critical code, so it's going to be hard to tell people to use 'cx::$var' instead of '$context['var']' in these areas. So we'd need to keep having a global point to the array.
2/ Because of (1) and general laziness from devs who might have $context so deeply carved into their DNA, we could/should/might use $context =& we::$cx, or cx::$cx, or something, but that means we can't use cx::$var, but instead we::$cx['var'], which only saves one byte compared to $context['var']. We could go as far as we:$c['var'], but even then, it's a bit ugly and all anyway...
3/ Some people might argue that we could simply rename $context to $cx, and be done with it, accept globals and that's it. :P
I'm looking into other solutions... So far I've found a strange one, which could work but only for variables that never change...
$context = get_object_vars(cx::getInstance());
This will effectively transform cx::$var into $context['var']. Seriously. But I'm guessing that, even without benchmarking it, this function call is not 'free' and thus can only be done on purpose at one point or another...
Ahhhhhhh... If only accessing a singleton variable was just as fast as accessing a global var! Why does it have to be about 60% slower..?!
The main problems are:
1/ Performance. $context is used in TONS of areas, including time-critical code, so it's going to be hard to tell people to use 'cx::$var' instead of '$context['var']' in these areas. So we'd need to keep having a global point to the array.
2/ Because of (1) and general laziness from devs who might have $context so deeply carved into their DNA, we could/should/might use $context =& we::$cx, or cx::$cx, or something, but that means we can't use cx::$var, but instead we::$cx['var'], which only saves one byte compared to $context['var']. We could go as far as we:$c['var'], but even then, it's a bit ugly and all anyway...
3/ Some people might argue that we could simply rename $context to $cx, and be done with it, accept globals and that's it. :P
I'm looking into other solutions... So far I've found a strange one, which could work but only for variables that never change...
$context = get_object_vars(cx::getInstance());
This will effectively transform cx::$var into $context['var']. Seriously. But I'm guessing that, even without benchmarking it, this function call is not 'free' and thus can only be done on purpose at one point or another...
Ahhhhhhh... If only accessing a singleton variable was just as fast as accessing a global var! Why does it have to be about 60% slower..?!
4008
The Pub / Re: Getting ready for an alpha release: WeCSS/Wess improvements
« on December 23rd, 2012, 11:12 AM »
Well, for starters, I just removed all occurrences of PREG_PATTERN_ORDER in the code. Cleaner.
I'm still of the opinion that we should rely on PHP's default behavior, because there has never been a case, AFAIK, where they changed it without ensuring that legacy code would still work. That's even the reason why explode() accepts parameter in two orders, although they recommend the use of explode($string, $array) for consistency with implode(). But still, the argument that "PHP may change its default behavior" doesn't really stand, if you'll allow me.
Then it just comes to ensuring that users are not confused with the code. Which is also a moot reason for me: I've always pictured object methods as being public, not 'by default' but simply because I didn't even know there were methods to conceal methods... I know, I know, PHP 4 vs 5, blah blah. Anyway, 'private' and 'protected' are keywords that are only going to mean something to very serious developers, and even they will know that the default is 'public'.
So, basically... I'd really, really like to keep code as short as possible. KISS, basically.
Or maybe the lack of alcohol will make you oppose this even more, I don't know... :^^;:
I'm still of the opinion that we should rely on PHP's default behavior, because there has never been a case, AFAIK, where they changed it without ensuring that legacy code would still work. That's even the reason why explode() accepts parameter in two orders, although they recommend the use of explode($string, $array) for consistency with implode(). But still, the argument that "PHP may change its default behavior" doesn't really stand, if you'll allow me.
Then it just comes to ensuring that users are not confused with the code. Which is also a moot reason for me: I've always pictured object methods as being public, not 'by default' but simply because I didn't even know there were methods to conceal methods... I know, I know, PHP 4 vs 5, blah blah. Anyway, 'private' and 'protected' are keywords that are only going to mean something to very serious developers, and even they will know that the default is 'public'.
So, basically... I'd really, really like to keep code as short as possible. KISS, basically.
Or maybe the lack of alcohol will make you oppose this even more, I don't know... :^^;:
4009
Features / Re: Something really strange just occurred to me
« on December 22nd, 2012, 11:58 PM »
Oh, take your time...
I have a feeling Wedge final won't be out for a while... :whistle:
(And we still haven't released Alpha 3... >_<)
I have a feeling Wedge final won't be out for a while... :whistle:
(And we still haven't released Alpha 3... >_<)
4010
Off-topic / Re: LG Nexus 4
« on December 22nd, 2012, 11:58 PM »
I'm waiting for the second iPad Mini to buy one and (finally) ditch my iPod for good. All the iPad Mini is missing is a Retina screen... Other than that, it has the perfect size for a tablet to me. (Please note the very thin margins on it. I love that. I've always hated that the earlier iPads had such huge margins, it made them look like a photo frame or, worse, a baby toy...)
4011
The Pub / Re: Getting ready for an alpha release: WeCSS/Wess improvements
« on December 22nd, 2012, 11:56 PM »
The we object is actually not finished at all... And it shows ;) I'd already made a few more changes to it even before you committed your changes... Thankfully, no conflicts. But still, I was heading towards something else. I guess it always feels strange having someone tell you how to code when you're right in the middle of it... I have my pride, as you know :lol:
I too am obsessional (is that even an English word?) about consistency. And because I'm also obsessional about keeping code as tight as possible (as long as it doesn't impair readability), in this case it was bound to clash with your obsession about documented code ;)
I too am obsessional (is that even an English word?) about consistency. And because I'm also obsessional about keeping code as tight as possible (as long as it doesn't impair readability), in this case it was bound to clash with your obsession about documented code ;)
4012
Features / Re: Something really strange just occurred to me
« on December 22nd, 2012, 11:53 PM »
I guess I'll just leave the programming to you then...... :niark:
4013
Off-topic / Re: LG Nexus 4
« on December 22nd, 2012, 11:51 PM »
I can understand that.
Hmm... I'm trying to make a quick review of all other possible phones I could get my hands on... Apart from the CloudMobile (which has the advantage of being so cheap I can survive seeing it break if I drop it by mistake...), I don't really see anything convincing. Meh...
Well, still, there's a reason why I went from my iPod to an Android phone, and survived the idea of no longer having my Scrabble app (which I played something like a thousand times in tw oyears), or my Monopoly Hotels app, in my pocket... And it's not just because I get extra freedom.
It's just that I'm into innovation, like you are. My iPod was innovative two years ago. But right now, if I want to replace it for a similar price, I can get the same machine, a tad faster, a few grams lighter, a centimeter taller, and way uglier. That's not innovation to me... When for the same price I could get a machine that's twice more powerful and actually allows me to phone as well.
Anyway...
Hmm... I'm trying to make a quick review of all other possible phones I could get my hands on... Apart from the CloudMobile (which has the advantage of being so cheap I can survive seeing it break if I drop it by mistake...), I don't really see anything convincing. Meh...
Posted: December 22nd, 2012, 11:48 PM
Well, still, there's a reason why I went from my iPod to an Android phone, and survived the idea of no longer having my Scrabble app (which I played something like a thousand times in tw oyears), or my Monopoly Hotels app, in my pocket... And it's not just because I get extra freedom.
It's just that I'm into innovation, like you are. My iPod was innovative two years ago. But right now, if I want to replace it for a similar price, I can get the same machine, a tad faster, a few grams lighter, a centimeter taller, and way uglier. That's not innovation to me... When for the same price I could get a machine that's twice more powerful and actually allows me to phone as well.
Anyway...
4014
The Pub / Re: Getting ready for an alpha release: WeCSS/Wess improvements
« on December 22nd, 2012, 11:46 PM »
I can see that I won't be able to convince you and you'll have a very hard time convincing me... We'll have to agree to disagree, which I'm not a big fan of... :-/
Then again, I don't understand why you're not bothered by the tons of missing 'public' keywords in our existing methods.
Then again, I don't understand why you're not bothered by the tons of missing 'public' keywords in our existing methods.
4015
Features / Re: Something really strange just occurred to me
« on December 22nd, 2012, 11:44 PM »
A real group with ID 0..? It doesn't make (too much) sense to me.
I'd rather have an extra group added by the installer (or importer), and everyone with group 0 would be put into it. It would simplify code refactoring a lot because you don't actually need to check everything again.
I'd rather have an extra group added by the installer (or importer), and everyone with group 0 would be put into it. It would simplify code refactoring a lot because you don't actually need to check everything again.
4016
Off-topic / Re: LG Nexus 4
« on December 22nd, 2012, 11:43 PM »
I don't really use cameras much. I don't go out a lot, and when I do, I don't tend to want to immortalize a moment. So I don't take pictures. But now, I know that if I want to, I'll have a good camera under the hand, i.e. the S3 ;)
It still won't be as good as my girlfriend's Canon reflex camera which cost me something like a Galaxy S3 and a half's worth, a few years ago... But it doesn't matter ;)
It still won't be as good as my girlfriend's Canon reflex camera which cost me something like a Galaxy S3 and a half's worth, a few years ago... But it doesn't matter ;)
4017
The Pub / Re: Getting ready for an alpha release: WeCSS/Wess improvements
« on December 22nd, 2012, 11:40 PM »
Size matters. Hence my $user_info rewrite, among other things...
PHP won't make protected the default, if anything to keep it backward compatible with older scripts.
So, yeah... To me, it's the same thing. PHP regularly adds new optional parameters to their functions. You don't need to specify these parameters, they're only there if you want to change them. So, when it comes to objects, it's the same to me: the simpler, the better. If you need to change a function's scope, you can. Otherwise, you don't have to...
PHP won't make protected the default, if anything to keep it backward compatible with older scripts.
So, yeah... To me, it's the same thing. PHP regularly adds new optional parameters to their functions. You don't need to specify these parameters, they're only there if you want to change them. So, when it comes to objects, it's the same to me: the simpler, the better. If you need to change a function's scope, you can. Otherwise, you don't have to...
4018
Features / Re: Badges and the displaying thereof
« on December 22nd, 2012, 11:38 PM »
Hmm.. Well, that means it's easily customizable indeed, but it's also less accessible to noob admins.
4019
Features / Re: Something really strange just occurred to me
« on December 22nd, 2012, 11:36 PM »
Thanks for bumping that topic, one of many I'd missed... (Would probably have found it if it had a more explicit name :P)
Oh, Noisen.com actually had from day one a specific 'regular members' group where all new members were put it. IIRC, it's nearly built into SMF itself, you just need to change a line or two in Subs-Members.php or whatever, in the registration function, there's a place to force a membergroup for new members. So, that's what I did... And it's easier to manage.
It'd be nice to move all members into a special group indeed. But how do we do that on import, eh...
Oh, Noisen.com actually had from day one a specific 'regular members' group where all new members were put it. IIRC, it's nearly built into SMF itself, you just need to change a line or two in Subs-Members.php or whatever, in the registration function, there's a place to force a membergroup for new members. So, that's what I did... And it's easier to manage.
It'd be nice to move all members into a special group indeed. But how do we do that on import, eh...
4020
Off-topic / Re: LG Nexus 4
« on December 22nd, 2012, 11:32 PM »
The PureView, isn't that what Pete has as well..?
I don't see the point, is it only for the camera?
What feels right to me doesn't actually exist. It should have the size of a Razr i, the screen and grip of an HTC One X, the design and compatibility of an S3, the price of a CloudMobile, the battery life of a Droid Razr Maxx, and the loudspeaker of a Nokia Lumia 920 (or, a bit worse, Galaxy Note 2). I could go on like this. ;) As I said, the S3 is either the best on some of these, or the second best. Apart from the buttons (which I found a fix for) and the width (for which I have nothing), it's hard to blame it for anything.
Maybe next year Samsung will release my dream machine... In which case I won't hesitate to sell my S3 and buy it. ;)
Oh, and for the anecdote:
- I first heard about the S3 while in San Francisco. Adverts everywhere. Having it... Well, feels like being in SF again.
- I bought it with my Aeva Media proceeds. I've kept the money in my PayPal account, and never use said account. So it's like I made Foxy! just to get an S3 two years later. I'm full of good ideas, ah ah.
I don't see the point, is it only for the camera?
What feels right to me doesn't actually exist. It should have the size of a Razr i, the screen and grip of an HTC One X, the design and compatibility of an S3, the price of a CloudMobile, the battery life of a Droid Razr Maxx, and the loudspeaker of a Nokia Lumia 920 (or, a bit worse, Galaxy Note 2). I could go on like this. ;) As I said, the S3 is either the best on some of these, or the second best. Apart from the buttons (which I found a fix for) and the width (for which I have nothing), it's hard to blame it for anything.
Maybe next year Samsung will release my dream machine... In which case I won't hesitate to sell my S3 and buy it. ;)
Oh, and for the anecdote:
- I first heard about the S3 while in San Francisco. Adverts everywhere. Having it... Well, feels like being in SF again.
- I bought it with my Aeva Media proceeds. I've kept the money in my PayPal account, and never use said account. So it's like I made Foxy! just to get an S3 two years later. I'm full of good ideas, ah ah.