mnardell
Programming Clojure, Fourth Edition: Use of the symbol *name* in defrecord example
Use of the symbol name in defrecord example potentially confusing
This is a small stylistic point, not quite an errata. On page 5, there is a small snippet of code, (defrecord name \[field1 field2 field3\]). If typed into the REPL, this code will result in an error: class clojure.lang.Var cannot be cast to class java.lang.Class... I think that the choice of using name in this example was intended as the indication of the semantics of the defrecord (that the name of the record is in the second position of the form). If so, perhaps using appropriate text formatting to indicate name is not the literal symbol name. One other comment, on page 11, the name is used as an argument in the small hello world example. This would seem to violate the advice not to use Clojure function names as parameters / arguments, as provided in the boxed note Conventions for Parameter Names on page 16
Popular Pragmatic Bookshelf topics
Other popular topics
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /python
- /js
- /rails
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /emacs
- /haskell
- /svelte
- /typescript
- /onivim
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /html
- /opensuse
- /deepseek
- /zig
- /centos
- /php
- /scala
- /react-native
- /lisp
- /sublime-text
- /textmate
- /nixos
- /debian
- /agda
- /django
- /deno
- /kubuntu
- /arch-linux
- /nodejs
- /ubuntu
- /spring
- /revery
- /manjaro
- /lua
- /julia
- /diversity
- /quarkus
- /markdown









