3 ms·
> at this point a perspective that it seems you clearly recognize is wrongheaded, but wish to defend anyway. I don't appreciate the accusation. At this point y
by zenhack 8y ago
> at this point a perspective that it seems you clearly recognize is wrongheaded, but wish to defend anyway.
I don't appreciate the accusation. At this point your own position is baffling to me as well, but I'm not going to make attacks; if it comes to that better to just walk away (I did this for a few days, because I was getting frustrated).
> Well, no. If you're claiming that the action of saying "I explicitly do not satisfy this interface" is, in a sense, a way of satisfying an interface
What I'm saying is that the built-in 'object' takes just this approach -- so if it does count as a way of satisfying an interface then (in both Python and JavaScript) every value satisfies every interface. If it doesn't, then user defined classes doing it isn't different from classes that ship with Python. I agree it's kindof weird to call that satisfying an interface; my claim is only that the explicit opting-out that `object` doesn't isn't any different than explicit opting-out in user code.
> The difference between overriding a method and overriding valueOf is that with a method, I control which specific interfaces I implement. With valueOf, its all or nothing. I cannot pick and choose which interfaces to implement. I've said this or a variant of it in nearly every post so far, and you've yet to respond to this point.
I similarly feel like I've been repeating myself with my response, which is not being heard:
This only matters if you're willing to treat the functions with special syntax (, / etc) as privileged. Otherwise `valueOf` is just another interface (representing coercion), and while it is definitely more poorly designed than the Python approach of having separate interfaces for each of ``, `/` etc, this only has any implications for a property of the language if you're willing to treat those interfaces (both `valueOf`/coercion and ``/multiplication, '+'/addition etc) as special. Some arbitrary function I write (in either language) doesn't (necessarily) use these interfaces. There are a fixed set of functions, imported by default, with special syntax, that use these interfaces (and of course code that calls those functions).
I think it absolutely is* defensible to claim the fact that these operations have specialized syntax makes them special in a way that's really "part of" the language, and if you take that as given, I think the rest of your argument is valid. But if you take those functions to be not really special, then behavior that only pertains to them doesn't inform questions about the language proper, just the libraries.
You've said that you agree the operator syntax is unimportant, but I'm having a hard time groking how else this is relevant.
I should also reiterate that this is a really nitty-gritty technical point I'm making; the ecosystem and libraries are the best thing about Python, so saying "it's just a library" should not be construed as "it's unimportant."
Re: Tensorflow, the resulting Tensorflow program/AST is statically typed, but it isn't a Python program, by any means. You can't put a Python while or for loop inside a Tensorflow program, call a python function, or basically do anything that's not encoded in the AST. You can use those when constructing the AST, but that's different. (Do correct me if I've misunderstood the design of Tensorflow). To use your own words
> [Tensorflow programs a]re no longer compatible with the rest of the language.
But this just isn't true of my examples where I forgo using javascript's built-in operators in favor of my own `mul`, `add` etc. functions. In the latter case, it's still JavaScript -- it can still be used with other JavaScript code in the full generality of any other functions I write.
I have some things to say about the Unit example as well, but I'm running late, so am going to stop here.
- joshuamorton 8y ago>so if it does count as a way of satisfying an interface then Right, but it doesn't. Fullstop, end of discussion. In python, if you don't satisfy an interface, your program immediately breaks. In javascript, it keeps on chugging, unless you do extra error handling. Really that's all that needs to be said. You can completely ignore the rest of this post if you wish. Because there is nothing else in it that matters. That fact alone makes js weak and python strong. And note it is a property of the language, and not apis. I can absolutely write interfaces that opt out of the weakness or strongness, but that's also true of strong typing (I can write apis that only accept object, or take in go's interface {}, or whatever). >You can't put a Python while or for loop inside a Tensorflow program, call a python function, or basically do anything that's not encoded in the AST. This is incorrect. You can indeed have tf call out to python. But more importantly, to use your own argument, what's a while loop but some specially favored syntax. While and for are really just operators (consider that for in python is used by fulfilling an interface exactly the same way one opts into * or +). You seem to be arguing both sides here. That using a different set of operators makes you a different languages if those operators are looping constructs, but doesn't make you a different language if they are binary constructs. >Re: Tensorflow, the resulting Tensorflow program/AST is statically typed, but it isn't a Python program This is my point. Neither is your "my-own-object-system-built-ontop-of-js" a js program. Its functionally speaking a different language with different semantics. Yes, you can call out from one to the other, but you can also call out from python to C and C to java. And when you do that you lose some level of introspection because the different languages don't implement fully cross compatible internal APIs. >it can still be used with other JavaScript code in the full generality of any other functions I write. Well no it can't. You cannot, for example, write a binary function that is polymorphic over all possible combinations of YOURTYPE and int.