# [ʞ] lib/prim.janet
#  ~ lexi hale <lexi@hale.su>
#  🄯 AGPLv3
#  ? declares the primitives supplied by gdjn
#  > (import /lib/prim)

(def *gd-api-ext* @{})

(defmacro- extern [name]
	(def sym (gensym))
	(put *gd-api-ext* sym name)
	~(def ,name ',sym))

# takes a string and returns a prim/class-handle
# for a native godot class
(extern class-load)

# an abstract that wraps a class and provides
# a uniform interface for both native godot
# classes and janet environment-classes
(extern class)
(extern class?)
# @-prefixed methods/props are implemented by the vm.
# everything else is passed through verbatim.
# :@janet? - returns true if underlying class is
#           a janet env
# :@methods - returns a list of methods
#  {:id method-id :args [(type/variant :Vector3) etc] 
#                 :ret (type/variant :String)}
# :@super - returns a handle to the superclass
# :@new - invokes a constructor, returning an object
# use :@janet? and :@env methods to retrieve a
# janet environment from a wrapped janet class

(extern object)
(extern object?)
(extern object/class)
# method calls on an object are translated to
# godot method invocations. index into a class
# to retrieve a property.

# explicitly create godot values
(extern type/dict)
(extern type/array)
(extern type/array-packed)
