~theo/gql#34: 
Examples nolonger work

Current example files are out of date. I have yet to learn the new api but at the moment at least example1.lisp is using the wrong api. For example

(defparameter *fields*
  (list
   (field :name "name"
               :type *string*
               :resolver (constantly "Theodor Thornhill"))
   (field :name "age"
               :type *int*
               :resolver (constantly 31))))

should be

(defparameter *fields*
  (list
   (field :name "name"
               :gql-type *string*
               :resolver (constantly "Theodor Thornhill"))
   (field :name "age"
               :gql-type *int*
               :resolver (constantly 31))))
Status
REPORTED
Submitter
~gavinok
Assigned to
No-one
Submitted
6 months ago
Updated
6 months ago
Labels
No labels applied.

~theo 6 months ago

On 9 Jul 2022 08:33, ~gavinok outgoing@sr.ht wrote: Current example files are out of date. I have yet to learn the new api but at the moment at least example1.lisp is using the wrong api. For example

(defparameter *fields*
  (list
   (field :name "name"
               :type *string*
               :resolver (constantly "Theodor Thornhill"))
   (field :name "age"
               :type *int*
               :resolver (constantly 31))))

should be

(defparameter *fields*
  (list
   (field :name "name"
               :gql-type *string*
               :resolver (constantly "Theodor Thornhill"))
   (field :name "age"
               :gql-type *int*
               :resolver (constantly 31))))

You are absolutely correct that they are out of date, unfortunately. I'll see if I can update them this evening or so. I will also make a real list of actionable task for me and/others to work on so that it will be actually useful.

I'm struggling a bit on the coersion between nil/false/null/true problem in lisp vs js, but we'll get there :)

Also I finally have some summer holidays, so there's that :)

Thanks for your interest!

~theo 6 months ago

At least the code now has one external reader!

;)

~gavinok 6 months ago

One idea you could try is using the same conversion that parenscript does

  • T
  • F
  • FALSE
  • NIL
  • UNDEFINED

T and FALSE (or F) are converted to their JavaScript boolean equivalents true and false.

NIL is converted to the JavaScript keyword null.

UNDEFINED is converted to the JavaScript global variable undefined.

https://parenscript.common-lisp.dev/reference.html#ssection-booleans

Only concern here would be the use of NIL since you would then have to consider the overlap of NIL and (). If you represent JS arrays as CL arrays this wouldn't be an issue.

Anyways just a thought that may interest you.

"~theo" outgoing@sr.ht writes:

[[PGP Signed Part:Undecided]] On 9 Jul 2022 08:33, ~gavinok outgoing@sr.ht wrote: Current example files are out of date. I have yet to learn the new api but at the moment at least example1.lisp is using the wrong api. For example

(defparameter *fields*
  (list
   (field :name "name"
               :type *string*
               :resolver (constantly "Theodor Thornhill"))
   (field :name "age"
               :type *int*
               :resolver (constantly 31))))

should be

(defparameter *fields*
  (list
   (field :name "name"
               :gql-type *string*
               :resolver (constantly "Theodor Thornhill"))
   (field :name "age"
               :gql-type *int*
               :resolver (constantly 31))))

You are absolutely correct that they are out of date, unfortunately. I'll see if I can update them this evening or so. I will also make a real list of actionable task for me and/others to work on so that it will be actually useful.

I'm struggling a bit on the coersion between nil/false/null/true problem in lisp vs js, but we'll get there :)

Also I finally have some summer holidays, so there's that :)

Thanks for your interest!

~theo 6 months ago

Yeah! I think doing the same as parenscript makes sense - I think using NULL is a good idea. I'll consider this moving forward - thanks!

As for the examples, I'll get to it eventually, as time permits :)

Register here or Log in to comment, or comment via email.