« first day (973 days earlier)      last day (3968 days later) » 

5:00 PM
Hm, that article makes me go "ew" a bit, but I asked for it.
 
You asked for it :)
   'public override triggerOneYearOlder': function()
    {
        this.__base.triggerOneYearOlder();

        this._salary *= 1.03;
    },
This all started because of that question.
 
Whenever I see a property prefixed with a _, I cry a bit, and force a random 6 year old girl to cry as well.
 
With all honesty, are you also that girl?
 
I bet public and private variables could be done with properties.
 
Good weather today
 
5:05 PM
And proxies.
Gosh, I have an evil idea. BRB with a new wheel design
 
@minitech If you're talking about enforcing access control with proxies we've already had an hour long discussion about it today :) (Implementing interfaces in JS with proxies)
 
@BenjaminGruenbaum Does it work?
 
After it's implemented in js, I bet WikiLeaks will do what they did to Java.
 
@minitech We haven't implemented it, but a PoC would be interesting.
 
If every class that's going to do something with another class is made using the same library, you don't even need proxies. Excellent.
 
5:09 PM
@amhed Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
// @minitech This is the syntax I've had in mind:

function Impl(){
    this.x = 15;
    this.y = 20;
}
function Iface(elem){
    this.x;
    //Proxy voodoo dark magic in debug mode
    // No type checks in production because proxies are slow atm
}
var a = Impl();
var b = Ifrace(a);

//this will block access to any properties of a other than x
//If a didn't have a property x, it'd throw an exception
 
wait for 2.2
i'll keep it modular so you can have it without classes
 
No, you simply can't do that without proxies. I don't want your huge class syntax, sorry :P
 
keyword: without
 
Morning
 
5:12 PM
Also, I'd argue that while interfaces are awesome and are very useful, classes are not ^_^
Like I said, I'm going to have to wait and see
@PeeHaa埽 mornin.
 
lol
 
@minitech Something like:
function Interface(fn){
	//get object, or construct if doesn't return object
	var iface = new fn();



	return function(impl){
		var handler = {
    		get: function(target, name){
        		if(name in iface){
		            return impl[name];
    			}
    			return undefined;
    		}
		};
		var p = new Proxy(impl,handler);
	};
}
Meh, indentation messed up, damn you sublime :/
 
0
Q: Javascript find and replace (customized)

maniootekvar MyAddress = " Google Ireland Ltd.<br> Barrow Street<br> Dublin 4<br> Dublin<br> Ireland "; Here I can split each line to array: var pieces = MyAddress.split("<br>"); now, how to make a loop now which check if there is "dublin" word duplicated, if YES then lea...

 
is it possible to find out if a string from localStorage has been stringified?
 
I think the solution for the above post must be easy
 
5:19 PM
@Connor round trip it and see if it matches?
but who would want to do that >_<
 
Dammit, nodejs supports the old proxy proposal and not the new one :(
So does Chrome :(
 
0
Q: .htaccess opencart rewrite script that is causing error

Rahul KhoslaI just need some basic help. A lot of people using GoDaddy may have the same issue. I'm using opencart on my main domain - http://graphicshop.net I have added domains on my GoDaddy hosting panel, http://rahulkhosla.co.uk and http://greenginger.info (this one works perfectly). The http://rahulk...

 
i saw this line whenever i enters this room , "Javascript Room Unofficial Rules and Guidelines. " but there are no "Javascript Room Official Rules and Guidelines"
 
Sorry, I can’t bear to finish this. gist.github.com/minitech/4f3193472b0f45b9d78b
 
function Interface(fn){
	//get object, or construct if doesn't return object
	var iface = new fn();

	return function(impl){
		var handler = {
    		get: function(target, name){
        		if(name in iface){
		            return impl[name];
    			}
    			return undefined;
    		}
		};
		var p = Proxy.create(handler);
		return p;
	};
}

function Impl(){
	this.x=5;
	this.y=10;
}

var Iface = Interface(function(){
	this.x =5;
});

var a = new Impl();
var b = Iface(a);

console.log(b.x);
console.log(b.y);
@minitech wtf is that :O?
 
5:25 PM
@BenjaminGruenbaum Horrible is what it is.
 
@BenjaminGruenbaum how does that ^ feel?
:P
 
@redline He was talking about his own code :P
 
arguments.callee.caller.toString(). Enough said.
 
:(
 
@minitech run this in nodejs under the --harmony-proxies flag github.com/benjamingr/interface-js
 
5:28 PM
@BenjaminGruenbaum The function is just to define which properties are accessible, right?
So this.x = true would work, etc.?
 
Yes, it only performs an in check.
 
So why not an array?
 
I want to be able to enforce functions and such.
Arrays might work though.
All it does is passthrough whatever is in the interface and return undefined. Next I'm adding a throw if we pass a non-implementor.
 
var iface = Interface({get public() { x, foo }});
(Sorry, I have syntax abuse syndrome.)
 
That doesn't look like valid JS :P
 
5:31 PM
It is...
And parseable.
 
no
it's not
 
The { x, foo } part?
 
you have a get accessor method with a body x, foo
wtf is that
 
@redline no need to be rude.
 
sorry
he was just very overconfident and claimed it parsed...i couldn't resist
 
5:33 PM
Something for use with function Interface(x) { var publics = Object.getOwnPropertyDescriptor(x, 'public').get.toString().match(/\w+/g); }
I think I might have possibly gotten that right.
@redline Whaddya mean “claimed”?
Try it in your console!
 
I don't want to parse function bodies :/ That's as bad as eval, or just passing strings imo.
Although that's something @redline might be interested in.
 
omg
 
function Interface(x) { console.log(Object.getOwnPropertyDescriptor(x, 'public').get.toString().match(/{.+}$/)[0].match(/\w+/g)); }
var iface = Interface({get public() { x, foo }});
 
@redline that might be able to improve your syntax :P
 
I almost did it right the first time.
 
5:36 PM
Why the property descriptor? Why not pass a function?
 
Anyways, I know you don’t want to. It’s just fun coming up with syntax abuse.
@BenjaminGruenbaum function public doesn’t look as horrible awesome as get public.
I don't know Markdown
 
---strikethrough--- strikethrough
Would typing be interesting?
 
@BenjaminGruenbaum Yes.
But not as a library. =P
 
Who said anything about a library?
 
@BenjaminGruenbaum I did. Now you have. Okay, what are we talking about exactly?
 
5:40 PM
I was thinking:
Interface({
    x:0,//has x, type of which is number
    getX:function(),//has a getX function, which accepts no arguments
    setX:function(x)//has a setX function, which accepts a single argument.
});
Just playing around with proxies, none of this is applicable anyway :P
 
Ooh. Fun.
 
What do you think about the syntax?
 
Needs more Hungarian notation.
 
Needs more cowbell.
 
5:41 PM
How about x: 'number'
 
Assigning strings to variables sounds like smell. Although number is less bad since it'd be the result of a typeof call.
 
I like the function syntax, though.
@BenjaminGruenbaum That’s the idea — and you could use the actual constructor for other types.
Although that would break function signatures; nevermind.
 
'public abstract ReturnTypeHint methodName(TypeHint1, TypeHint2)': function(){..}
:P
 
@redline No no no no no no no.
 
@redline Needs more jQuery.
 
5:43 PM
ahaha
2.3
@BenjaminGruenbaum i saw your super awesome jquery room
 
@redline It was awesome, and Jeff Atwood and John Resig were room owners.
 
uh huh yea
cause @BenjaminGruenbaum added them >_<
 
@minitech @redline can you clone the repo and check that you can run example.js and it works correctly?
 
i don't think i can clone the repo
i can barely sync commits using their shitty software
 
git clone <repoaddress> ?
 
5:49 PM
@redline ????
 
yea see now why i wouldn't i just want to copy-paste that using that link
soooooooooooooo much better
 
5
undefined
Breach of contract prevented!
Success in enforcement Error: Breach in interface contract:  Interface function y not a function in implementor
 
oh i thought that that was just a regular JS file
i didn't realize it was node
i pasted it in chrome to find no module :)
 
@minitech Thanks :)
 
5:52 PM
Also, git://github.com/benjamingr/interface-js. Because, you know, the Git protocol.
 
@BenjaminGruenbaum and you still think abstract is stupid?
ugh >_<
i don't know what to do with you
 
Sprite sheet packer, is there any importer for in in JS @Loktar, @Gni33 since you linked me it... though i am on the verge of writing my own ?
 
Don’t we all think both of them are stupid?
 
Testing :)
I know I'm a sick sick person, but I love writing unit tests
@redline Yes.
@redline Abstract classes are a dumb concept and interfaces are an amazing one.
 
they are exactly the same thing for what you are doing
 
5:55 PM
No, it's very different
Interfaces enforce a contract
That's what they're for
Abstract classes enforce nothing, they're for when we act like children and not adults and pretend we don't trust our own code.
 
not our own code, others code
 
How often were the guy writing the abstract class and the guy writing the abstract one different people?
Almost never.
 
which is EVERYONE
 
Interfaces defines contracts teams can work with.
Abstract classes are Java's retarded take on mixins.
 
you can't instantiate an interface
by itself it is useless
 
5:56 PM
Of course not, it's a contract. That's the point.
 
@redline You can't instantiate an abstract class.
 
but i can still call a base constructor
and have an object constructed for me and just extend whatever functionality was defined
i dont just have a contract and have to build everything from scratch
 
You don't need abstract classes for that.
 
interfaces have their uses but they don't solve all the problems
 
Abstract classes are retarded in JS, they serve no use.
 
5:58 PM
@BenjaminGruenbaum Abstract classes
 
if you say so
proxies have no implemenations
 
@minitech Yeah.
 
@BenjaminGruenbaum You could argue that interfaces are too, though.
 
they have uses
but it's not enough
 
That is to say, you define the interface by just using the object.
 
5:59 PM
@minitech Interfaces are useful when working in large teams of coders and you want to share a contract with another team.
 
But I think we get that this is just fun with proxies.
 
Yeah, just fun, pretty much.
Explicit interfaces are mainly useful for testing and documentation. I'd like to conceptually work with an interface and not an object.
You could have release mode which would drop all the checks just relaying the object. which would eliminate speed loss.
 
Yeah — isn’t it nicer to just share documentation, do a few error checks, and use methods and whatnot?
Who needs all this static typing when we have duck typing‽
 
We're not doing static typing, we're just enforcing contracts. That's very different imo.
 
(… okay, I do)
@BenjaminGruenbaum My bad.
 
6:01 PM
@minitech ? :P
 
@BenjaminGruenbaum I called it static typing and it’s not?
 
I know this is a silly question, but why is it `bad` to pass less arguments to a function.

ex. function test(a, b) <-- test(1);
 
Not every contract is about types. It's not about having less bugs in code, it's about being able to define contracts reliably between teams of coders.
 
@DaveChen It‘s not bad! … context?
 
6:02 PM
@DaveChen It's not, it's called overloading. You can do it in other languages too. As long as you expect that in the function it's ok.
 
I mean like, I tried using a JS tidy application, and it threw some errors when I tried to do that.
 
Closure Compiler is insane.
Also in a good way. But still insane.
 
Yeah, it's insane
 
I've dabbled in the code, played with it...it's insane.
 
@minitech Anything else you'd like in except for functions and function parameters?
I've pushed btw
@redline what do you think about the syntax? (github.com/benjamingr/interface-js)
 
6:18 PM
@Zirak Agreed. They could actually make much more out of it. A jshint that understands your code much better, for example
 
@copy Ever tried one of them vim plugins for WebStorm?
 
No, but I only heard bad stories about those
 
:P
I was just saying that because it offers much better understanding than JSHint.
 
Too many errors. (13% scanned). oh gosh on this
 
@BenjaminGruenbaum I am weirdly interested in your IDE witchery
 
6:22 PM
@copy Woah! You mean something that actually understands your code and warn you of stupid mistakes ahead of time? Something that handles clever 'gotchas', greys out unexecuted code paths and such? Why would you want that?
@copy 3.8
 
3.8 fps?
 
wow 112mb for this ~ WebStorm, gonna try this out
 
Drops down after a while.
 
800k cell patterns are hard
 
6:25 PM
Chrome stuck on gen 63
 
Check memory
 
one sec, have to restart
Gets to 1000MB, then drops back to 700MB
 
Hey, anyone here know Android? (not a question, just a quick thing)
 
I have to rethink the garbage collection strategy
 
I run things that take ~3000MB here. I don't think that was the bottleneck in my case.
 
6:31 PM
Yeah
 
Is json a good format for writing game assets :?
 
It always doubles the size of the hashmap (which takes a significant amount of time at some point), but after rehashing, the number of elements isn't that huge
 
right now the asset is a 2d file :$ but i am wondering if json makes sense :-| for really huge files , my text file generated by sprite sheet packer is smaller then json but parsing it everytime on client is turnoff for me :P
 
Because when I rehash, I also get rid of unused nodes
 
@minitech Just so you know, you caused @redline to re-code his entire library there :P
 
6:38 PM
There's a reason programmers don't build planes and there's a reason plane engineers don't write programs
 
He'll just find that offensive again :P
 
@BenjaminGruenbaum what is going on ?
 
@Esailija Remember when we talked about doing interfaces in JavaScript?
@Esailija Oh, @minitech Just told @redline he can do a .toString on functions and get a much cleaner syntax than he's using atm.
 
@Esailija Is there a faster way to allocate a huge array than using a for loop?
 
Anyhow, I whipped up a small poc, very simple, just ~ 50 lines of code
@copy How many elements?
 
6:40 PM
@copy like over 100k?
 
2^24
 
!!> Math.pow(2,24)
 
@BenjaminGruenbaum 16777216
 
just loop 16 million times
 
That's what the gemini takes
 
6:41 PM
 
Okay
 
you can only preallocate without looping when you have under 100k
 
@Zirak That always happens after doing Python :( Thanks!
 
And prefixing your breach call strings with a space is meaningless, since you already suffix it inside breach
Also, you're not padding + with spaces, but that's just your style I guess. I hate you.
 
6:44 PM
@copy holy shit though, you having 16M*(4 doubles + object)?
 
Yeah
 
@Zirak fixed and fixed.
 
Thank you
 
It's a quadtree with a bounding box of 8 million cells
 
So by very conservative calc that is
!!> Math.pow(2,24)*80 / Math.pow(2,20) + " megabytes"
 
6:45 PM
@Zirak Any comments on syntax?
 
@Esailija "1280 megabytes"
 
Anything less than that is just micro optimization :P
 
well in worst case you can still try just flat out using typed arrays for everything
yes it's ugly but yea
so is duplicating code so Set takes 2x less memory
:C
 
@BenjaminGruenbaum Not much to talk about at this point. Your function is nicely named, but could be broken a bit into smaller ones.
 
@BenjaminGruenbaum like how?
 
6:48 PM
greedyness is a bad quality :-(
 
1 hour ago, by redline
wtf is that
 
so encoding it in function name
 
today is an absolutely horrible day, BOTH of my domain controllers crashed :(
what god forsaken update caused this crap
 
@redline :(
 
oh yeah I also use that for code generation
instead of storing javascript in strings, you can store it in functions and toString those
^^
 
6:52 PM
still cleaner
 
but this is mainly a syntax boost for getters and setters?
 
copy.sh/life/?pattern=caterpillar (7.6 MB, freezes Firefox for 10 seconds)
I like how the first version couldn't display a glider at 30 fps
 
What's the expensive part? Calculating neighbors or drawing?
 
msdn is not that bad :-( ... seriously msdn is helping !
 
Calculating
 
6:56 PM
Do you calculate every turn on every cell?
 
I learned how to do drawing efficiently with this project
No
 
What's the heuristic for checking if you need to draw?
 
I walk down the tree, skipping parts where no cell is alive and everything that is outside of the screen
 
6:58 PM
@copy you can also request patches from v8 if you have a good case
 
where the heck can i download dat-gui ?
 
@Esailija huh ... what would I ask for? Maybe arrays with type hint, or type hint for integers
 
|0 does that unless you have multiplication
firefox 21 has Math.imul already
it will be in next chrome too
 
@Manas Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
7:04 PM
I always benchmark changes and never got an improvement from things like that
 
@copy what about typed arrays?
 
That's an option, but then I essentially have to write my data structures in C
 
@Esailija would be so thrilled :P
 
is it possible to run this without dom
 
Yeah
Except for the drawing part, of course
 
7:10 PM
I wouldn't need to draw since calculation is what needs to be improved right?
 
Yes
 
I would just take a look at the assembly of the tight functions
but for that I need to run it in the v8 debugger which doesn't have dom
 
Can you load files (patterns)?
 
yes there is load() function that is like php include
or you mean generic file io?
 
The latter
 
7:12 PM
@rlemon can u host something form me :? again ?
 
nope, can those files be expanded to e.g. JSON?
 
Sure
 
or it would need to be jsonp, something that runs as javascript
 
@BenjaminGruenbaum What address should I send emails to? @tipranks or @gmail?
Or does the former link to the latter, so it doesn't matter?
Which would make sense
 
@Zirak Probably @gmail
@tipranks is my work email, gmail is my personal one.
 
7:16 PM
On second thought...I'll wait a few days.
Expect an email in the next 1-8 days or years or any time unit.
 
@Esailija Hang on, I'll create a command line version for d8
 
@copy sure
not sure if I have time to look into it today
 
@Zirak Don't be a pussy :P
 
But it takes time to word out how I feel about you :(
oh. yes. goat porn.
Definitely related to goat porn.
 
LOL
 
7:19 PM
!!google benjamin gruenbaum goat porn
 
google already indexed it
 
May 20 at 0:16, by Zirak
He will forever have "goat porn" in his google search
 
gives past-me a high five
 
Thanks :P
 
7:21 PM
and a smart delete right there
 
Google has "About 2,360" when googling that
I. Win.
 
@BenjaminGruenbaum Cleaner? I never said cleaner. Don’t follow that advice, @redline!
 
@minitech Too late, muhahaha
@minitech I added a typecheck flag by the way, you can now specify the typeof value you want for primitives.
 
@BenjaminGruenbaum Oh, that’s kinda fun.
 
@copy how necessary are the large numbers of > Math.pow(2,30)?
 
7:26 PM
@minitech Ideas appreciated.
 
@BenjaminGruenbaum Arrays and/or object literals ;)
 
How? What do you mean?
 
Goat Porn whats that ?
 
@Esailija That depends. Mostly they can be smaller than 2^30, but not for some values
 
What the heck is porn?
 
7:29 PM
@copy the ones you have 16 million of, if you can keep them under 2^30, they take 3x less memory and are stored almost directly
under or equal
 
@Darkyen Check a dictionary!
 
!!/define porn
 
@Darkyen porn (uncountable, informal) Pornography. [from the mid-20th c.]
 
but I see your pow function can return 2^500
 
@Esailija How do I do that
 
7:30 PM
@BenjaminGruenbaum Like {public_things: ['y']}
 
It's only pornography from the mid-20th cent?
So porn below 25 cents isn't pornography?
 
Have a hint every time I set the variable?
 
yea just never store a value that goes over that
 
@Zirak lol
 
@minitech What would you have other than public things?
 
7:33 PM
@Esailija I'm not doing that
At least not on purpose
 
@BenjaminGruenbaum The typecheck option :)
Or it could be two arguments and just one, unnamed array. I don’t mind :D
 
@minitech Oh, right now I either enforce it on all elements or none. you mean like a "per element" check?
 
anyone ever worked with eBay api?
 
@copy anywhere in life.js, where you use, pow, the function returns a type of double
 
@BenjaminGruenbaum No, more like combining the options and the public members. {public_things: ['y'], typecheck: true} rather than {public_things: ['y']}, {typecheck: true}.
 
7:35 PM
like in set_bit
 
@Esailija But I'm only using pow in function where it's necessary
 
@minitech Right now it's more like {y:"string"},{typecheck: true}
 
When I actually need doubles
 
@BenjaminGruenbaum Oh. So not this.y = "string" anymore?
 
The first argument is the interface itself, what I wanted (but typecheck kind of screws) is to be able to actually create an element from the 'interface' itself and pass it to the interface and get a mock.
 
7:36 PM
@Esailija That's not one of the slow functions
 
@minitech That's just function constructor syntax.
 
Hang on, I'm creating a benchmark for d8
 
yeah I was only wondering if nw/ne/sw/se can be integers
 
@BenjaminGruenbaum Yes, but your code calls what’s passed to it.
 
but I guess it won't be infinite enough with just a Math.pow(2, 30) max value?
 
7:37 PM
{public_things: {y: "string"}, typecheck: true}?
 
Those are objects (Other TreeNodes)
 
@minitech I don't really understand why you'd wrap that in an object?
 
@BenjaminGruenbaum Named arguments are pretty, plus you already have an options object.
 
Yeah, but it's (no pun intended) optional :P
 
It doesn’t really matter, though, just another choice of style that gives that wonderful Python flavour.
 
7:38 PM
@copy right :D
 
... wait
 
Either way is better than a constructor, though =)
 
i hate my host!
 
The constructor is just to look oopy :P
 
Maybe give properties a default clause?
{ y : { type : 'string', default : 'blah' } }
Or { x : { default : function () { ... } } }
 
7:46 PM
What would that then do? Would that provide a default implementation?
 
darkyen.vacau.com/test.html <- okay check it out pls :D , my puny steps on canvas :-(
 
//like how you can have
class Foo {
    string y = 'blah';
}
Also, @BenjaminGruenbaum, you haz mail.
Stupid mail.
 
@Zirak I'm still not sure, is the point default values for implementors?
 
oh yeah. You're doing interfaces. Ignore me.
...remember earlier when you said I was on fire? It extinguished...
 

« first day (973 days earlier)      last day (3968 days later) »