« first day (1662 days earlier)      last day (3286 days later) » 

10:00 PM
hey
I need some help with a composer error. github.com/composer/composer/issues/3997
I have no clue how to start fixing it. Also someone gave me a solution but Im not aware where to start :s
 
is it ok if I use opline->extended_value to store some other flag not related to arg count?
@bwoebi rephrase... what's extended_value exactly?
 
guys is a __valueOf() (or __toBool __toInt __toFloat etc) magic method possible these days? iirc someone proposed it but time was not ripe yet :P
maybe as interfaces StringValue BoolValue FloatValue IntValue
 
@Worf That can be useful
 
@Worf nope
 
@Duikboot Try just checking everything out into a new directory and running it from there. Or follow the diagnose thing they suggested?
 
10:08 PM
@marcio although comparable could be enough for most cases
 
I can try moving out the project folder outside htdocs of mamp ( Not using MAMP ) but its in that folder.
 
@Duikboot Try following instructions on issue or reinstall composer
 
maybe ->equals() @marcio ?
 
@Duikboot No, not moving stuff around. Do a fresh check out.
 
@marcio It's just a multipurpose uint32_t which fills the struct padding…
 
10:09 PM
As in reinstall composer? :)
 
if($foo) same as if($foo->equals(true))
 
No....your code, which is in a VCS right?
 
not yet :)
 
if the equals method is not specified then evaluate like php does now
 
It's just an empty project which I would like to start with.
 
10:10 PM
@marcio it's just like the last 4 byte of _zval_struct
 
based on the tutorial of @Patrick but I can't get the composer running for the JSON file.
 
i've suggested dividing Comparable rfc into Comparable(has ->equals()) and OrdinalComparable(has both ->equals() and ->compareTo())
 
@PeeHaa E_PEBCAK
 
@bwoebi ok, so if I set a high bit nothing will break... that's good enough for now :)
 
@marcio it depends on what opcode you set it
 
10:12 PM
ok, thanks :)
 
So, what exactly are you trying to do?
 
@Worf you can do it on your userland code already
 
?
 
@Worf oh, you want if($foo) not if($foo->equals(true))
 
yup, basically if($foo) must call implictly the "magic method" $foo->equals(true)
 
10:14 PM
honestly, I don't think any RFC regarding this will pass, you should check the mailing lists more :P
 
why not, it's not going to break anything
 
Ok, removed composer - installed again. Same error
 
@bwoebi I'm working on callable types
 
interface Compare{
    function __equals($other) : bool;
}
interface CompareOrder extends Compare{
    function compareTo($other) : int;
}
 
@marcio I hope you choose your variance etc. wisely…
 
10:17 PM
Sweet fixed it @Danack Installed BREW and ran the commands from the comments
 
@php7prophet @NikiC what do you think of that ^
 
@bwoebi that will be tricky ^^
 
@marcio I mean… first determine the rules (write them up, discuss them)…
 
@bwoebi I'll share the test cases along with the draft RFC
 
well, let's see :-)
 
10:20 PM
but right now I just want to try a dirty proof of concept so possible technical issues can be noticed in advance
 
@marcio need help writing the tests? :P i really want to help. writing tests is something i can do
 
@bwoebi not now :P, soon
 
@marcio the implementation itself shouldn't be too hard…
 
@bwoebi I <3 when you say that...
-.-
 
That just means it is feasible without completely restructuring the ZE :-D
[Unlike e.g. by-variable passing…]
 
10:23 PM
@Worf use your willpower on another thing, something more useful
BTW there is a "comparable" RFC already, ping the author if you really want to proceed
 
@marcio Also… I don't mean this would be a children's play for me. Just not too hard.
 
@marcio like.... crumping dance?
@marcio i know i was talking about that :P
i already pinged the author but i havent had success
 
RFC: Kill PHP
 
^ she is the author
 
@Andrea wait 11 months.
 
10:27 PM
@Andrea ... and put something else in place
 
@bwoebi :'(
 
> basically if($foo) must call implictly the "magic method" this way $foo->__equals(true)
 
just for curiosity, do you want to support comparison only?
 
well if you think about it that would cover tons of cases
 
don't have separate methods for equals and full comparison
isn't $a < $b always legal currently? it won't error, right?
it'd be bad if it did
 
10:31 PM
almost nothing that should error errors xD
 
@Andrea not all types have a natural order
 
And if you have a mechanism to allow defining a custom equals function but not the other comparison operators, what do you do if the object is compared?
Error?
 
most of times you only need ->equals()
 
@Worf Sure, but they still need to be ordered somehow
my proposal would be something like:
public function compareTo($that): ?int {
    if ($that instanceof self) {
        return $this->value <=> $this->value;
    }
    return NULL;
}
Note how it's ?int, a nullable return type
If you return NULL, which happens implicitly if there's no return statement (ugh), then it'd fall back to whatever the default behaviour is
 
yes i've read your comment on github. it's ok
 
10:34 PM
:p
 
for me it's fine :P
but that wouldn't solve comparing with scalar types or checking for equality :P
 
yes it would?
why wouldn't it?
public function compareTo($that): ?int {
    if ($that instanceof self) {
        return $this->value <=> $this->value;
    } else if (is_scalar($that)) {
        return $this->value <=> $that;
    } else {
        return NULL;
    }
}
 
how? if($instance) calls ->compareTo(true) which returns an integer, which would be converted to boolean then?
 
@Worf well, yes
 
question: if we get union types, doesn't nullable return types become obsolete?
 
10:37 PM
All the comparison operators in PHP can be implemented in terms of three-way comparison
@marcio Yes, but union types are a bad idea in PHP
 
I still fear the Dog|Apple|Reactor scenario
 
I hope they're not added. But what do I care, I don't use PHP and quit development 3 months ago :p
 
you never quit, you only have a very persistent illusion of quitting
 
also separating the two methods is sometimes you rely on in languages like java. for example you want $a == $b evaluated to true (via .equals()) but at the same time you might want $a->compareTo($b) returning non-zero
 
@marcio public function kill(UNIX\Process|RealWorld\Person $foo)
@Worf that's awful, don't do that
>= differing from combining == and > should never happen
 
10:40 PM
it's not awful, most of times they return the same value, but sometimes they dont
 
No, it's awful
>= is == and > combined
If you want to do a fuzzy equals, add a method for it :/
Don't break PHP's comparison operators and confuse users, please
That's also an advantage of having just a single magic compare method: prevents someone from accidentally (or not) making ==, <= and >= not match
If you really don't want to implement the stuff other than equality:
public function compareTo($that): ?int {
    if ($that instanceof self && $this->value === $that->value) {
        return 0;
    } else {
        return NULL;
    }
}
 
i'm not sure. i've read in the past solid arguments about why it's good having two methods (but i don't remember them :P)
 
@marcio No, it's just a special case.
?Foo literally is Foo|null if we add union types
@Andrea On what premise?
 
0
Q: Legitimate cases of having .equals() behaving inconsistently with .compareTo()?

WorfJava documentation says it's "strongly recommended" to have them behaving consistently. But are there legitimate cases of java/c#/python/etc Object.equals() method behaving inconsistently with the method Comparable.compareTo()?

cv-pls
:D
 
@LeviMorrison weak types
 
10:52 PM
@Andrea unions sometimes can solve problems where there are two [external] classes not implementing an interface
 
@Andrea That's a phrase, not a premise. Explain.
 
I think I've explained it several times before, but how do you decide to convert?
 
@Andrea yes, that needs special resolution. But I think we've already discussed that here…
 
I'm also not really convinced you need it for well-written code
 
@bwoebi According to @NikiC it's a non issue. I generally trust his technical judgement.
 
10:54 PM
Nullables, sure, you need them. Superclasses of the basic types too. But unions?
 
@Andrea Enums are just a special case of union types. Is code using enums inherently bad?
 
enums are well-typed, though
 
They are no less well typed than a union.
 
@Andrea Can one intelligently superclass basic types? except maybe scalar?
 
They are just a special case where all the type constructors take no parameters.
 
10:55 PM
@bwoebi scalar, number
@LeviMorrison int|float isn't the same as SomeUnion or SomeEnum
 
@Andrea number is not an union type.
 
SomeUnion and SomeEnum are actual types
 
Or… would you e.g. allow NAN in number? that sounds pretty contradictory.
 
Their members have the type of the union
 
int and float are real types too! You take that back!
 
10:56 PM
So SomeUnion::Foo has the type SomeUnion
This isn't true for int|float though
int doesn't have the type int|float
 
@Andrea You are looking at it the wrong way.
type number = int | float;
 
@bwoebi NaN is a special value that the float type can have
 
That means any int or float is a number.
 
@Andrea or like string|Array<string> … isn't that a valid union?
 
It's not that int is a subtype of a number.
 
10:57 PM
@LeviMorrison does it?
 
@Andrea sure. But that doesn't make it a number.
 
@Andrea Just look up definitions of union, intersection and enumerated types.
Enumerated types are just a particular special case of union types.
 
I am familiar with that
 
@LeviMorrison … intersection? Well… wat?
[in the context of types?]
 
I just... I don't think there's really a good reason to allow foo|bar|qux
 
11:00 PM
Maybe not. I do think there are plenty of valid uses though.
 
Usually you need it because it makes an API "convenient"
But it's also probably dangerous because, well, weak types
 
@bwoebi Yes. Things like Countable&Iterator. If you pass an iterator that implements both it passes the check.
 
int|float and the like are a particular problem
What does that mean in terms of how the value is handled?
 
@Andrea Eh, @NikiC said it's not an issue.
 
@LeviMorrison Ah, I now get what you mean.
 
11:01 PM
Are you doing different things depending on the types?
Or are you accepting anything number-like?
In the latter case, number better expresses intent
 
type number = int | float;
Done.
 
Sure
Though that should probably be a built-in type
 
Perhaps.
 
@Andrea I don't disagree. But that's not a reason why not allow userdefined unions
 
OK, but you still have this issue:
2 mins ago, by Andrea
Are you doing different things depending on the types?
 
11:03 PM
10 mins ago, by bwoebi
@Andrea yes, that needs special resolution. But I think we've already discussed that here…
 
No
I'm not talking about weak typing here, though that does cause problems
I mean what the function you're writing does
Does the function body check the argument type and do different things depending on what the type is?
 
you mean overloading?
 
Yes.
 
no.
That's an absolute no-go.
 
Yes, but a lot of the use cases for this seem to be overloading.
7 mins ago, by bwoebi
@Andrea or like string|Array<string> … isn't that a valid union?
This one, for instance.
Array<string> isn't a supertype of string. You're defining a "convenience" overload.
 
11:05 PM
@Andrea ideone.com/AkMbPb :D
 
@Worf Ah, but that's Java, Java doesn't have operator overloading
 
@Andrea Even if that's true, why is that bad?
 
@Andrea Totally aware. It is some sort of overloading. An union type will end up like overloading in any case (just like you could have two methods which call a common private method)
 
Especially if I'm already doing it without specific types?
You won't convince me array | Traversable is bad.
And no, array should not become Traversable automatically unless we revamp a lot of our type system.
 
@LeviMorrison Well, one reason is that with PHP's weak typing, your function will unpredictably sometimes do one thing and sometimes another completely different thing.
 
11:08 PM
@LeviMorrison Why shouldn't it?
 
@LeviMorrison I think there should be some superclass for that
 
@bwoebi An array is not an object. It cannot possibly an instance of Traversable.
 
array|Traversable is a hack
 
@Andrea how does that got to do with that? :P basically one decimal is not precise enough to guarantee value equality with the more precise one, but in ordinal terms they are considered equal
 
@Worf that's not why you got that result
 
11:09 PM
*what
 
== can't be overloaded in Java, right?
 
@Andrea Nope.
 
@LeviMorrison consider an array a special type of object which is by-value.
 
@bwoebi In PHP terms that means it isn't an object.
 
doesn't matter @Andrea == in java uses .equals
 
11:09 PM
@LeviMorrison ?
 
@Andrea In Java you cannot overload ==.
 
@Worf oh, it does? in that case, OK, what BigDecimal is doing is awful
 
@LeviMorrison so, an array containing references is an object, right?
 
== does not use .equals for any given type.
 
yeah, I thought it didn't
@Worf == is not .equals(). Try using .equals() there
 
11:11 PM
I mean maybe for Special Types. Maybe.
 
yay, found a bug in PCRE
 
Oh, maybe BigDecimal is special
 
@bwoebi No? [&$foo] is not an object.
@ircmaxell Upstream or our fault?
 
@Andrea System.out.println(new BigDecimal("1.00").equals(new BigDecimal("1.0"))); still false
 
3v4l.org/nJDOe <-- that should fail, as ( is not connector punctuation
 
11:12 PM
It behaves like one. Whenever you write to $array[0], all the other instances of that array will have [0] updated too.
 
@Worf huh, apparently BigDecimal makes .equals() and .compareTo() different, interesting
 
I misread what you wrote.
 
But that doesn't matter, because those don't overload operators
I'd be upset if you could make == and <= conflict.
 
Sure, objects with all their values being references I suppose is kind of like an object.
 
I'm not sure that Java is necessarily the best place to look for guidance - goo.gl/Yb3zVB
 
11:14 PM
And to be clear I'd love arrays to actually be objects.
 
@Andrea that's what i said :P
> basically one decimal is not precise enough to guarantee value equality with the more precise one, but in ordinal terms they are considered equal
 
I know
 
yay, with that fixed, I have a lexer written to lex JS
 
@LeviMorrison As long as arrays retain their by-value semantics.
 
I misunderstood because it was misleading in context
 
11:15 PM
 
@bwoebi Fine by me, probably.
 
If it was making == and <= not match that'd be bad, but Java doesn't have operator overloading
@Danack hah
 
$js = <<<'EOF'
if(/[a-zA-Z0-9]+/.match("123")) {
	console.log("test");
}
EOF;
 
@LeviMorrison And now. Where's the difference between an array and an object today except passing semantics?
 
array(22) {
  [0]=>
  array(2) {
    [0]=>
    int(17)
    [1]=>
    string(2) "if"
  }
  [1]=>
  string(1) "("
  [2]=>
  array(2) {
    [0]=>
    int(59)
    [1]=>
    string(14) "/[a-zA-Z0-9]+/"
  }
  [3]=>
  string(1) "."
  [4]=>
  array(2) {
    [0]=>
    int(1)
    [1]=>
    string(5) "match"
  }
  [5]=>
  string(1) "("
  [6]=>
  array(2) {
    [0]=>
    int(4)
    [1]=>
    string(5) ""123""
  }
  [7]=>
  string(1) ")"
  [8]=>
  string(1) ")"
  [9]=>
  array(2) {
    [0]=>
    int(55)
    [1]=>
 
11:16 PM
@bwoebi Plenty. Look at the engine and there's a big clue.
 
@LeviMorrison no. from userland.
users don't care about engine.
 
is_object([]) // false
Doesn't have any interfaces or anything.
Cannot subtype it.
(sure you could say it's just a final class)
 
Anthony is going to write a JS interpreter in PHP with a backend to compile it to recki-ct IR if it's asm.js compatible…
 
@LeviMorrison let's use the @NikiC approach!
class Array extends BaseObject
class Object extends BaseObject
/s
 
the BaseObject is called stdClass btw...
 
11:19 PM
nope
PHP has no basic object from which all objects inherit
 
?
 
stdClass isn't a parent of any type…
 
StdClass is just an empty class
 
I'd love it if you couldn't add ad-hoc properties to classes except stdclass which technically just does sugar around it with __get/__set
 
well… then make every other class extend it…
 
11:20 PM
@bwoebi inefficient
 
@Andrea implicitly, not explicitly
 
@Andrea And dumb if I want to disallow ad-hoc properties ^^
 
@bwoebi still inefficient engine-wise
 
@Andrea why?
 
@bwoebi now you have to do inheritance stuff for all classes?
 
11:22 PM
@Andrea all what we have here is the name in instanceof. Which one could compile to a typecheck opcode at ct.
 
We could lie I guess, yeah
 
(and functions like is_a, yea)
 
Though in that case, don't call it StdClass
Call it object
Make StdClass a class_alias
 
But… for what reason ever would just explicitly want an object typehint?
 
@bwoebi to know if I can use ->?
array | ArrayAccess
 
11:27 PM
@LeviMorrison … and what'd you write behind the ->?
 
Yeah I don't know.
 
@LeviMorrison this one makes a lot of sense @Andrea
 
But you can't call []->offsetSet(1, 1)
 
@LeviMorrison me neither ;-D
 
Make array implement ArrayAccess
 
11:28 PM
(But why would you? You can just use the [] notation…)
 
26 secs ago, by Levi Morrison
But you can't call []->offsetSet(1, 1)
 
@Andrea Golly it may as well be an object.
 
I've mentioned this before but I think there should be a shadow class hierarchy for the basic types
@LeviMorrison Well make that possible!
 
make a traversable equivalent of ArrayAccess (with no methods) ?
 
@Andrea Only if it's an object.
 
11:28 PM
That is, make a class for each of the basic types
@LeviMorrison oh, right, offsetSet, that can't be done on normal arrays
And then check that class when you try to use instanceof etc. on a basic type
Also allows adding scalar methods
 
@Andrea class Array implements ArrayAccess, Countable, Traversable, Serializable … yeah… ^^
 
@bwoebi and class Integer extends Number :D
well
Hmm, not sure about Boolean/Null
But null doesn't need to be special in PHP, so why can't it have its own class, now that I think about it?
 
class True extends Boolean, class False extends Boolean
 
@bwoebi Or...
 
class Boolean extends Primitive
 
11:31 PM
enum boolean{ true, false }
 
enum Boolean {
    True,
    False
}
 
boom!
 
@Andrea that doesn't mirror casting etc. :-D
how can an enum be cast to 1? wtf!
 
@bwoebi ah, of course ;)
 
It'd imply if (False) would be true^^
because it's an not-null object
@Andrea I absolutely hate that java has a primitive and an object way to express e.g. integers.
These two things shouldn't be different.
 
11:36 PM
@bwoebi Nah
internal classes are special, remember
@bwoebi yup, I don't like it either
 
Null is a type which also only has one value.
It's a true singleton.
 
@Andrea With crazy semantics like in Generics… <? extends Object> … yeah… you can't pass in a primitive.
(HashMap etc. if you know)
 
@Andrea In general it doesn't work because of if… which I just noticed Bob already noting ^^
 
yeah, things have to be wrapped
 
@Andrea Oh, I'll have fun extending Boolean…
 
11:38 PM
to be fair, they do in any similar language
it's just Java doesn't hide it from you
@bwoebi We can be evil and make them final >:D
 
@Andrea That's not evil…
 
@Andrea sorry. True and False extend Boolean. You can't make it final.
 
well, it prevents another kind of evil :p
 
[or maybe you can, but it's like a bug]
 
@bwoebi Yes you can.
You shouldn't, but you can
 
11:39 PM
@bwoebi With enumerations they are final but the enum subtypes still can extend it.
 
because, well, we write the rules
 
This is what Java does.
 
we can do anything we like
 
The compiler doesn't let you do it but the bytecode is happy to do what it is told.
 
@LeviMorrison yep
 
11:41 PM
in Lounge<C++>, 5 hours ago, by fredoverflow
user image
5
 
@LeviMorrison in our case, we don't have a bytecode!
 
@Andrea We have opcodes though :)
 
@LeviMorrison not for class creation, though?
the class definitions are just structs in memory we can do whatever we like with, right?
 
@HamZa undefined behavior ftw^^
 
@rdlowrey I've had some internet issues and some OS driver issues and stuff.
As such leviathon is not always available – just ping me if you need it and I can accomodate.
 
11:46 PM
Hey everyone, I'm having a hard time wrapping my head around the Twitter API and what I'm trying to achieve (it might be stupid/impossible), here's the workflow: users authenticate using twitter (oAuth 1.0) => they authorize my app to post tweet from their account => Whenever I post a tweet, I want to be able to track its replies (which is in itself a bit tricky, saw some post I can link regarding workarounds since twitter doesn't officialy provide a "conversation" REST endpoint).
On the other hand, there is the "stream api" which I simply don't get, I think it might be the solution to my issue (see userstream/replies dev.twitter.com/streaming/reference/get/user), do any of you have any experience in a similar behavior / in the stream api?
 

« first day (1662 days earlier)      last day (3286 days later) »