 
 # Dict = Object.create.bind null, null, Object.create null
 
-unless Array::last
-  Object.defineProperty Array::, "last", get : -> @[@length-1]
-
-unless Array::first
-  Object.defineProperty Array::, "first", get : -> @[0]
+do (arrayProto = Array.prototype, {defineProperty} = Object)->
+  # set up .first and .last getters for Array prototype
+
+  "last" of arrayProto or
+    defineProperty arrayProto, "last", { get: -> @[@length-1] }
+
+  "first" of arrayProto or
+    defineProperty arrayProto, "first", { get: -> @[0] }
 
 # KD Global
 KD = @KD or {}

KD.log   = log   = noop
KD.warn  = warn  = noop
KD.error = error = noop

@KD = $.extend (KD), do ->
  # private member for tracking z-indexes

Function::bind3 or= (context) ->
  if 1 < arguments.length
    args = [].slice.call arguments, 1
    return => @apply context, if arguments.length then args.concat [].slice.call arguments else args
  => if arguments.length then @apply context, arguments else @call context

Function::swiss = (parent, names...)->
  for name in names
