     if _.isFunction object
       Context.add_component ctx, React.DOM.div null,
         "#{lead_string} is a server function"
-        Components.ExampleComponent value: "help 'server.functions.#{object.values[0]}'", run: true
+        Components.ExampleComponent value: "help 'server.functions.#{object.fn_name}'", run: true
     else
       Context.add_component ctx, React.DOM.div null,
         "What do you want to do with #{lead_string}?"


dsl_fn = (name) ->
  result = (args...) ->
    new dsl.type.f name, (process_arg arg for arg in args)...
  result.type = 'i'
  result.fn_name = name
  result.values = [name]
  # TODO this will break f.bind() etc.
  result.__proto__ = new dsl.type.i


#  s: string
#  i: identifier
#  o: jsonable object

create_type 'f', dsl.type, (@name, @args) ->

dsl.type.f::to_target_string = ->
  "#{@name}(#{(a.to_target_string() for a in @args).join ','})"

dsl.type.f::to_js_string = ->
  "#{@name}(#{(a.to_js_string() for a in @args).join ','})"

create_type 'q', dsl.type, (@values...) ->
dsl.type.q::to_target_string = ->
  @values.join ','

dsl.type.q::to_js_string = ->
  "q(#{(@values.map JSON.stringify).join ', '})"

create_type 'p', dsl.type, (@value) ->
# numbers, strings, jsonable objects, and booleans use json serialization
dsl.type.p::to_js_string =
dsl.type.p::to_target_string = ->
  JSON.stringify @value

create_type(n, dsl.type.p, (@value) ->) for n in "nsbo"

dsl.type.TRUE = new dsl.type.b true
dsl.type.FALSE = new dsl.type.b false

# Graphite doesn't support escaped quotes in strings, so avoid including any if possible.
dsl.type.s::to_target_string = ->
  s = @value
  if s.indexOf('"') >= 0 or s.indexOf("'") < 0
    quoteChar = "'"
  else
    quoteChar = '"'
  quoteChar + s.replace(quoteChar, "\\#{quoteChar}") + quoteChar

create_type 'i', dsl.type, (@value) ->
dsl.type.i::to_target_string = dsl.type.s::to_target_string
dsl.type.i::to_js_string = -> @value
dsl.type.i::toJSON = -> {@type, name: @fn_name}

dsl.type.o::to_target_string = ->
  objects = to_string_context.objects ?= []
  i = objects.length
  objects.push @value
  "param('objects',#{i})"

process_arg = (arg) ->
