Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

javascript wins yet again

Name: Anonymous 2012-10-19 17:48

Name: Anonymous 2012-10-19 17:53

/batock el Necker Haws/

Name: Anonymous 2012-10-19 18:01

JAVASCRIPT GOD LANGUAGE

Name: Anonymous 2012-10-19 18:01

PRAISE BE TO JAVASCRIPT AND MOHAMMAD IS HIS LAST MESSENGER

Name: Anonymous 2012-10-19 19:51

Just use m4

Name: Anonymous 2012-10-19 21:15

>>5
not js!

Name: Anonymous 2012-10-19 22:49

>>1
>javascript reinvents a core language feature in lua with an API

Name: Mentifex 2012-10-19 23:57

Name: Anonymous 2012-10-20 0:27

This is pretty much a request.

Anybody knows where I can find a precisely defined algorithm for a binary-tree based heap data structure?

All I can find is either array-based or fuzzy as fuck.

Thanks in advance.

Name: Anonymous 2012-10-20 0:31

>>9

Wow did I reply to an existing thread instead of creating one...

Fuck, sorry for the noobness.

Name: Anonymous 2012-10-20 1:48

>>7
>implying this has been done before

Name: Anonymous 2012-10-20 2:25


function Proxy(object, handler)
  local p = {}

  local get
  if handler.get ~= nil then
    get = function(target,key)
      return handler.get(object, key)
    end
  else
    get = object
  end

  local set
  if handler.set ~= nil then
    set = function(target,key)
      return handler.set(object, key)
    end
  else
    set = object
  end

  setmetatable(p, {
    __index = get,
    __newindex = set
  })

  return p
end

function contains(object, key)
  return rawget(object,key) ~= nil
end



Examples
Very simple example

An object with 37 as its default value when the property name is not in the object


handler = {
  get = function(target, name)
    local key = rawget(target, name)
    if key ~= nil then return key
    else return 37
    end
  end
}

p = Proxy({}, handler)
p.a = 1
p.b = "fuck you undefined isn't necessary!"

print(p.a, p.b) -- 1, "fuck you undefined isn't necessary!"
print(contains(p, 'c'), p.c) -- false, 37



No-op forwarding proxy

In this example, we are using a native Lua object to which our proxy will forward all operations that are applied to it.


target = {}
p = Proxy(target, {})

p.a = 37 -- operation forwarded to the proxy

print(target.a) -- 37. The operation has been properly forwarded



See also

    * "Lua is awesome" Brendan Eich presentation at LuaConf (slides)
    * Lua Already Implemented This proposal page and Lua builtin features page
    * Tutorial on Lua builtin feautures that were there since day one
    * Old Javascript Proxy Attempt API page

Name: >>12 2012-10-20 2:42

and lua can actually do this more succinctly. I had to modify the usual style a bit to get it to fit with the javascript examples. Usually you don't need to introduce a proxy object and instead just make objects directly inherit from other objects.

Name: Anonymous 2012-10-20 14:10

>>12
>>13
... wat

Name: Anonymous 2012-10-20 14:14

>>14
I don't see what an Ethiopian stew has to do with anything.

Name: Anonymous 2012-10-20 15:00

>>12
i don't get what's so impressive about this. how is this even close to javascript's power?

Name: Anonymous 2012-10-20 15:10

>>16
did you click the link in >>1?

Name: Anonymous 2012-10-20 16:54

>>17
I'm not going to click on any links poasted here, do you think I'm insane?

Name: Anonymous 2012-10-20 18:34

>>18
it's a fucking link to mozilla, stop being a paranoid fuck and blaming your shit life on the kikes

Name: Anonymous 2012-10-20 19:17

>>19
But mozilla is a Japanese sponsored monster set on nothing less than total world domination.

Name: Anonymous 2012-10-20 19:19

Who would win in a fight: Mozilla or Mothra?

Name: Anonymous 2012-10-20 19:38

>>21
Yes

Name: Anonymous 2012-10-20 19:40

>>21
Who wouldn't win?

Name: Anonymous 2012-10-20 20:05

>>22,23
/prog/ - ENTERPRISE RESULTS

Name: Anonymous 2012-10-20 20:17

i can't wait for ecmascript 6
holy shit
my dick is so hard

it has all the niceties of python
but more concise, 20x faster and with real lambdas, fast graphics and 2.5 billion people with access to auto updating runtimes.

2013 will be the beginning of a golden era in computing

Name: Anonymous 2012-10-20 20:19

>>25
i fucked your mom javashit kike

Name: Anonymous 2012-10-20 20:22

>>25
There will still be people Windows users using IE 7 and with Windows Update disabled because ``it's annoying''.

Name: Anonymous 2012-10-20 20:28

>>27
Frankly, I don't blame them. It's entirely Microsoft's fault we're in this mess.

Name: Anonymous 2012-10-20 20:41

>>27
xp is being deprecated next year, and updates for ie9+ happen in background and their feature support is competitive with chrome/ff since microsoft is forced to take web/open source seriously by pouring money into node and so on.

ie8 down to 13% and ie7/6 is >2 combined.

http://gs.statcounter.com/#browser_version-ww-monthly-201209-201209-bar

the golden age is coming and you can't stop it

Name: Anonymous 2012-10-20 21:07

>>29
All of the IEs are updated via Windows Update.

Name: Anonymous 2012-10-21 9:45

Name: Anonymous 2012-10-21 10:28

>>27
>IE7
>not IE6
>implying IE6 isn't the single greatest browser of all time handsdown

Name: Anonymous 2012-10-21 12:07

>>32
Enjoy your record number of exploits and massive failures on almost every standards test ever.

Name: Anonymous 2012-10-21 14:12

>>32
le meme arrows face

Don't change these.
Name: Email:
Entire Thread Thread List