<_death>
wait, that example is fine.. there are just two extra lines there that probably shouldn't be
<aeth>
probably meant to show an ambiguity
<aeth>
the whole thing is confusing, though, because of *read-default-float-format*
<aeth>
(float 1 .5) => 1.0 is fine
<aeth>
as is (float 1.0)
<aeth>
Though their types may vary. (float 0) and (float 1/2) may show up as 0.0f0 and 0.5f0 if *read-default-float-format* is DOUBLE-FLOAT
tok has joined #commonlisp
ebrasca has joined #commonlisp
<aeth>
it's missing e.g. showing that (float 1.0d0) says 1.0d0
<_death>
generally you shouldn't ever have *read-default-float-format* other than single-float in non-specialized contexts
<aeth>
It's hard to really demonstrate FLOAT when *read-default-float-format* is invisible (so what 1.0 reads as is unknown, and what prints as 1.0 vs what shows the suffix is unknown) and even then 1f0 could be the same as 1d0 in some implementations
<aeth>
And yes, the real issue is that *read-default-float-format* is awful and you break code if you set it to something else and this may still happen anyway so you basically have to append "f0" to the end of every single single-float in your code or else next time you make that mistake you'll find out
<_death>
again, what you're saying is a misunderstanding of *read-default-float-format*
<_death>
no
<_death>
when a CL programmer writes code, the expectation is that *read-default-float-format* is single-float..
agrosant has quit [Ping timeout: 264 seconds]
<aeth>
1.0 in a file may, depending on the global, be read as 1.0f0 or 1.0d0... no matter what, it will print as 1.0 (and whichever isn't the default will have the suffix appended)... unless single-float and double-float are the same thing, of course, which is permitted. So demonstrating FLOAT without clarifying the context can't really be done.
<_death>
when you READ your own stuff (a specialized context), you may bind *read-default-float-format* to something else, as long as you know it makes sense
tok has quit [Remote host closed the connection]
<aeth>
You can assume *read-default-float-format* is single-float and write code that breaks sometimes. Or you can defensively write "f0" at the end of all of your single-floats. I do the latter.
<aeth>
Technically, ASDF should probably block this bug.
<_death>
again, you have it backwards
igemnace has quit [Read error: Connection reset by peer]
<aeth>
Writing 1.0 for 1.0f0/1f0 assumes that *read-default-float-format* is single-float, which should always be true outside of local/specialized contexts, but is, in fact, not always true.
<_death>
if you load Other People's Code with *read-default-float-format* bound to something that's not single-float, it doesn't matter how "defensive" your code is.. your world will break, possibly with (safety 0) and bad type declarations
<_death>
so the rule is to only bind *read-default-float-format* to something else when you know and expect that what you READ will give the right result
<aeth>
...and always end your single-floats in "f0"
<_death>
no
<_death>
again
<aeth>
because my code does not in fact break when *read-default-float-format* is DOUBLE-FLOAT even though it absolutely should not be
<aeth>
It's like writing cl:in-package to be extra-defensive because the last package in the state might not have COMMON-LISP:IN-PACKAGE as an imported symbol. It's defensive.
<_death>
in CL, *read-default-float-format* is single-float by default, and since it should only be bound to something else in specialized contexts, a CL programmer can expect it to be single-float when writing code in general
<aeth>
Amusingly, I found out that beach writes cl:in-package right about when I stopped using it.
<_death>
I also don't write cl:in-package
green_ has joined #commonlisp
<aeth>
my code is also case-safe... (symbol-name '#:foo) instead of "FOO" when building symbols from e.g. concatenation... a bit verbose, but it's future-proof. This absolutely would break things, far more than *read-default-float-format* would, but it wouldn't break my code. Amusingly, *read-default-float-format* probably doesn't break a lot of code because people who carelessly write 1.0 probably don't care
<aeth>
most of the time. It'd probably work unless you try to FFI or store it in an array of the wrong element-type etc.
zetef has quit [Remote host closed the connection]
<_death>
of course it will break.. the people who "carelessly" write 1.0 may also (declare (type single-float ...))
<aeth>
they may, but they probably will not... because people who actually use single floats probably got burned by *read-default-float-format* a few times already and added "f0"s everywhere, like I did
<aeth>
as single floats instead of as floats, I mean
<_death>
I know all this well because in my early CL days I also got it wrong and tried to set *read-default-float-format* in .sbclrc
<aeth>
well, I've never broken everything but my own code with *read-default-float-format* and it doesn't (or shouldn't, anyway) break anymore
<_death>
nobody gets burned by *read-default-float-format* if they don't misuse it.. and that's why people use 1.0 and declare single-float and that's why CLHS using 1.0 and not 1.0f0 is fine
<aeth>
declaring 1.0 as a single-float is putting an awful lot of trust in a global variable to always be the correct value...
<_death>
to expect everyone to write 1.0f0 when they want a single float is utopian thinking
<aeth>
1f0
<aeth>
no extra characters
<_death>
it's not about the character count..
<aeth>
and utopian thinking is expecting people to do (symbol-name '#:foo) to make sure their symbol-magic is case-agnostic instead of implicitly assuming upcase
<_death>
aeth: a CL programmer always puts a lot of trust in special variables, like *read-base* for example
<_death>
in the same way someone shouldn't (setf *read-base* 8) in their .sbclrc, they shouldn't set *read-default-float-format*
<aeth>
(symbol-name '#:foo) is quite clever because if you're doing odd things with reader case then it'll read it that way, and handle it correctly
<aeth>
_death: the difference is that *read-base* is going to break literally everything and be immediately obvious, while *read-default-float-format* will seem to work (just gives more precision, really) until someone has a declare, a check-type, a checked type slot in a data structure, etc.
<_death>
you're right about that.. I use "FOO"
igemnace has joined #commonlisp
<aeth>
the reader case stuff is somewhere between "break literally everything" (*read-base*) and "possibly just subtly change things" (*read-default-float-format*) because it'll (probably) break a bunch of macros
<_death>
aeth: what I'm saying is that we already live in a world where people expect *read-base* 10 and *read-default-float-format* single-float..
yitzi has joined #commonlisp
<aeth>
integers being base 10 is an assumption in just about anything with integers, which is a lot of code... many things will explode
<aeth>
*read-default-float-format* being changed will continue to work! mostly.
<_death>
aeth: not in my experience :)
<aeth>
for instance, 1/2 of the 4 FLOAT examples continue to work (but mean something else) when *read-default-float-format* is changed
<aeth>
and the others won't immediately implode things
agrosant has joined #commonlisp
<_death>
sure, the probability of fault may be different, but nobody expects *read-default-float-format* double-float except the people who have it in their .sbclrc, and these people are the minority going against CL default conventions and therefore they will have a bad time, and their libraries will not work for the majority of CL users if they then don't code "defensively" and use 1.0 to mean 1.0d0
<aeth>
A huge amount of float code continues to work when the precision changes. A huge amount. Unlike changing the base of integers or the case of the reader.
yitzi has quit [Ping timeout: 252 seconds]
<aeth>
Because the changes are subtle unless you explicitly say "x is a single-float" somewhere and the implementation tells you no (probably at compile time, fortunately)
yitzi has joined #commonlisp
<_death>
it doesn't matter that a huge amount of code appears to work if there's some code that won't
<aeth>
it means write code so you're not the bug
<aeth>
someone else can get the bug report where they have to explain how it works
<aeth>
never set *read-default-float-format* but never break if someone does.
<_death>
and some of the code that won't will also not give an CL error but bad results or memory faults (looking at (safety 0) and declarations now spoiled.. of course code that uses (safety 0) probably shouldn't be used anyway)
<aeth>
(safety 0) that's not contained within a locally should probably be a compiler error (-:
<aeth>
it basically only exists to cheat at benchmarks
<_death>
again, the bug is elsewhere, not in writing 1.0...
pillton has quit [Remote host closed the connection]
<aeth>
1.0 isn't the source of the bug, but it is a style error (in my style) for being insufficiently defensive in an easily preventible way.
<aeth>
and doing the same for *read-base* is unnecessary because literally all code (well, close enough) breaks so there's no point
<_death>
you say easily preventable, but I would say it's obfuscating and a futile endeavour
<_death>
different styles :)
<aeth>
being explicit is literally the opposite of obfuscating
<aeth>
but, yes, different styles
<_death>
now, do you test your code regularly with *read-default-float-format* bound to double-float? :)
King_julian has quit [Ping timeout: 252 seconds]
cage has joined #commonlisp
<aeth>
no, but I backwards search to SETF at the start of the SLIME REPL session so fast that I don't read what I'm typing
<aeth>
so every now and then (such as after this conversation! but, alas, I made sure to not make that my most recent SETF before closing) I do get the random testing in for some random global being set incorrectly
<aeth>
to automate it, it wouldn't really be a unit test, it would have to test a whole (fresh! uncached!) compile, it would be slow
<_death>
slow and pointless.. there's this guy who refuses to write 1.0f0 and declares his 1.0 using stuff single-float :)
<aeth>
alternatives include having the build system set the globals so it never fails... or fail as early as possible by ERRORing if the global differs (as in, check the value and error)
<aeth>
all 3 work
markb1 has joined #commonlisp
<_death>
I'm liberal in taking in code that gratuitously uses 1.0f0
<_death>
if you start using "9." instead of "9", though...
<aeth>
at that point, with *read-base*, option 3 (error if it differs) makes the most sense for being defensive, but it'll already fail before it gets to your file so it will never run that code path
<aeth>
one line of error beats a lot of .s
<_death>
there's no escape from an illicit *readtable*
<aeth>
when you mess with the reader too much you basically get C (or you literally get C if you mess with it a lot in exactly the right way)
<_death>
well, at least 1.0 is double in C :)
<aeth>
but not in shader/shading languages that otherwise take C syntax
<_death>
yeah, these guys even had those half floats invented..
<aeth>
yeah they should've called them short floats like in Common Lisp
<aeth>
it's like they never even read the hyperspec
<_death>
waiting for CLSL
mm007emko has quit [Read error: Connection reset by peer]
<aeth>
in CLSL, 1.0 will be doubles even though you don't usually use them on consumer GPUs
mm007emko has joined #commonlisp
<_death>
this last year I've been working exclusively with a 15 years old 13" laptop, so it's fine
<ixelp>
Dynamic Languages Wizards Series - Panel on Language Design - YouTube
<Josh_2>
Speakers: Paul Graham, John Maeda, Jonathan Rees, Guy Steele
dcb has quit [Quit: Connection closed for inactivity]
<Josh_2>
Actually posted ages ago, idk why it was randomly suggested to me (can't complain)
dnhester` has quit [Ping timeout: 255 seconds]
tyson2 has joined #commonlisp
a51 has joined #commonlisp
zaymington has joined #commonlisp
zaymington has quit [Ping timeout: 256 seconds]
decweb has joined #commonlisp
<_death>
Josh_2: the other panels are also great
danse-nr3 has quit [Ping timeout: 256 seconds]
zetef has quit [Remote host closed the connection]
chomwitt has joined #commonlisp
nerap has joined #commonlisp
josrr has joined #commonlisp
tisanae has joined #commonlisp
a51 has quit [Quit: WeeChat 4.2.1]
chomwitt has quit [Ping timeout: 268 seconds]
nerap has quit [Ping timeout: 264 seconds]
agrosant has quit [Ping timeout: 264 seconds]
nerap has joined #commonlisp
rgherdt_ has joined #commonlisp
rgherdt has quit [Ping timeout: 260 seconds]
agrosant has joined #commonlisp
NotThatRPG has joined #commonlisp
green_ has quit [Ping timeout: 252 seconds]
agrosant has quit [Ping timeout: 264 seconds]
Josh_2 has quit [Ping timeout: 246 seconds]
nerap has quit [Ping timeout: 246 seconds]
AndreiDuma_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
st_aldini has quit [Ping timeout: 268 seconds]
King_julian has quit [Ping timeout: 264 seconds]
st_aldini has joined #commonlisp
alcor has quit [Ping timeout: 240 seconds]
jjnkn has joined #commonlisp
dnhester` has joined #commonlisp
King_julian has joined #commonlisp
agrosant has joined #commonlisp
AndreiDuma has joined #commonlisp
AndreiDuma_ has joined #commonlisp
dnhester` has quit [Ping timeout: 240 seconds]
AndreiDuma has quit [Ping timeout: 246 seconds]
danse-nr3 has joined #commonlisp
danse-nr3 has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
akoana has quit [Ping timeout: 260 seconds]
agrosant has quit [Ping timeout: 264 seconds]
rtypo has joined #commonlisp
AndreiDuma has joined #commonlisp
tisanae has quit [Quit: WeeChat 4.1.2]
AndreiDuma_ has quit [Ping timeout: 246 seconds]
agrosant has joined #commonlisp
a51 has joined #commonlisp
nij- has joined #commonlisp
AndreiDuma has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
agrosant has quit [Ping timeout: 264 seconds]
gizmatic has joined #commonlisp
chomwitt has joined #commonlisp
gizmatic has quit [Quit: gizmatic]
jonatack has quit [Ping timeout: 264 seconds]
kevingal has joined #commonlisp
robin_ is now known as robin
ymir has joined #commonlisp
Lycurgus has joined #commonlisp
chsasank2 has joined #commonlisp
gizmatic has joined #commonlisp
gizmatic has quit [Remote host closed the connection]
chsasank has quit [Ping timeout: 268 seconds]
chsasank has joined #commonlisp
justache is now known as fotastache
chsasank2 has quit [Ping timeout: 268 seconds]
nij- has quit [Ping timeout: 264 seconds]
ymir has quit [Ping timeout: 264 seconds]
dnhester` has joined #commonlisp
nij- has joined #commonlisp
chomwitt has quit [Ping timeout: 255 seconds]
King_julian has quit [Ping timeout: 272 seconds]
triffid has quit [Remote host closed the connection]
danse-nr3 has quit [Read error: Connection reset by peer]
nij- has left #commonlisp [Using Circe, the loveliest of all IRC clients]
dcb has joined #commonlisp
triffid has joined #commonlisp
fe[nl]ix has quit [Quit: Valete!]
chsasank8 has joined #commonlisp
fe[nl]ix has joined #commonlisp
chsasank has quit [Ping timeout: 260 seconds]
chsasank8 is now known as chsasank
dnhester` has quit [Ping timeout: 246 seconds]
bendersteed has quit [Quit: bendersteed]
dnhester` has joined #commonlisp
anticomputer_ has quit [Ping timeout: 260 seconds]
anticomputer has joined #commonlisp
dnhester` has quit [Ping timeout: 256 seconds]
varjag has quit [Quit: ERC (IRC client for Emacs 27.1)]
igemnace has quit [Quit: WeeChat 4.2.1]
wacki has joined #commonlisp
dnhester` has joined #commonlisp
zxcvz has joined #commonlisp
fotastache has left #commonlisp [bye?]
jrm has quit [Quit: ciao]
ymir has joined #commonlisp
jrm has joined #commonlisp
AndreiDuma has joined #commonlisp
ymir has quit [Ping timeout: 264 seconds]
pfdietz has quit [Quit: Client closed]
akoana has joined #commonlisp
alcor has joined #commonlisp
rainthree has joined #commonlisp
mgl has quit [Ping timeout: 256 seconds]
ymir has joined #commonlisp
chomwitt has joined #commonlisp
zxcvz has quit [Quit: zxcvz]
ymir has quit [Ping timeout: 260 seconds]
oneeyedalien has joined #commonlisp
Lycurgus has quit [Quit: leaving]
nij- has joined #commonlisp
<nij->
Are there examples where a macroexpansion involves non-symbols showing up in the expanding AST?
oneeyedalien has quit [Quit: Leaving]
nij- has quit [Killed (NickServ (GHOST command used by nij_))]
nij_ has joined #commonlisp
nij- has joined #commonlisp
nij- has left #commonlisp [#commonlisp]
nij_ has quit [Client Quit]
tyson2 has quit [Read error: Connection reset by peer]
nij- has joined #commonlisp
AndreiDuma has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AndreiDuma has joined #commonlisp
ymir has joined #commonlisp
<bike>
nij-: (defmacro foo () '(progn 4))
<bike>
that's a cons _plus_ a fixnum
ymir has quit [Ping timeout: 268 seconds]
rgherdt_ has quit [Remote host closed the connection]
rgherdt has joined #commonlisp
<nij->
Sure, but you have to start with (foo), which is just an AST of a symbol `FOO.
King_julian has joined #commonlisp
<bike>
are you asking if you can define non symbols to be macros? because in that case the answer is no.
mgl has joined #commonlisp
<nij->
Err I'm just wondering if it's possible to have (F a b c) where, say, b is neither a symbol nor a list (making up of symbols or lists of symbols or so on), where F is a macro.
<nij->
Even if (let ((b (lambda () ()))) (F a b c)) wouldn't evaluate b into a function before macroexpanding..
<bike>
(defmacro id (x) x) (id 4)
<gilberth>
Yes, look at what `,x is read by SBCL annoyingly. It hides code in structure objects.
monospod has joined #commonlisp
<_death>
you can pass any object to a macro function.. if you do, you usually have to make sure that it's externalizable
<gilberth>
It reads as (SB-INT:QUASIQUOTE #S(SB-IMPL::COMMA :EXPR X :KIND 0)). But that is a business of that SB-INT:QUASIQUOTE macro then.
<bike>
or that the macroexpansion doesn't involve it, which i think is how sbcl backquote works
<_death>
right, I had macroexpansion in mind because of the initial query
<nij->
Right. But usually we have to start with evaluating a list (F a b c) where F is a macro, and a b c are lists (of lists of lists..) of symbols.
<bike>
i gave you an example of something else like two minutes ago
<nij->
On the other hand, the macro function (also called F) can take in any object.. so I wonder some natural use cases.
<gilberth>
Huh? a b c could be anything. And why bother?
<bike>
it's not that uncommon to have other objects in your source code
<nij->
bike - (id 4) .. 4 is still a symbol to start with.
<bike>
it is not a symbol
<nij->
After it's expanded to the symbol 4, it evaluates to 4.
<bike>
no, it's just 4
<bike>
it did work like that in some ancient 1960s lisps, i think, but we live in brighter days
<nij->
Which way?
<nij->
Having 4 as a symbol and then a number after evaluation?
<nij->
Oh I see, you mean that 4 is parsed as an integer even at read time?
<bike>
in some lisps, there weren't really any numbers, they were just special symbols
<bike>
but in modern lisp, 4 is 4. it is just an integer, indeed
<bike>
you could try: (type-of (read-from-string "4"))
<bike>
where did you get the idea it would turn into a symbol?
<nij->
(symbolp 4) => nil ; indeed
<nij->
Hmm.. I forgot @@.. maybe from descriptions of other lisps..
<_death>
what other lisps
<nij->
forgot
amb007 has quit [Ping timeout: 255 seconds]
<gilberth>
Must be some very curious one. Even LISP 1.5 had numbers distinct from symbols.
<gilberth>
It's only the original paper that doesn't talk about number objects and instead says that there are atoms and cons cells and nothing else.
<_death>
indeed.. old lisps didn't have strings and people used symbols, but I'm not sure I remember any that used symbols for numbers
<gilberth>
And 4 is still an atom but not a symbol.
<nij->
Yeah maybe the original paper.
<nij->
Also read some lambda calc stuff.. sorry for the confusion!
<gilberth>
Then you confuse atoms with symbols. Symbols and numbers are subtypes of atoms.
rainthree has quit [Quit: Leaving]
mulk has quit [Ping timeout: 264 seconds]
* edgar-rft
wants Lisp molecules
<gilberth>
edgar-rft: Huh? We have those. Made from CONSing atoms. But what about quarks rather?
drakonis has quit [Quit: WeeChat 4.1.1]
mulk has joined #commonlisp
<edgar-rft>
Lisp used IMPLODE and EXPLODE before it joined string theory.
<phoe>
a cons is made from five quarks: two paren quarks, one dot quark, one cdr quark and one car quark
<phoe>
ordering these is left as an exercise for the quantum measurer
<_death>
after cons there comes a hunk
King_julian has quit [Ping timeout: 264 seconds]
<nij->
What are lisp molecules..?
dra has joined #commonlisp
drakonis has joined #commonlisp
istewart has joined #commonlisp
<phoe>
they're the tiny things that make up the lisp image
<mfiano>
bike: is christian still doing molecular metaprogramming? I lost track of clasp
mgl has quit [Ping timeout: 256 seconds]
<younder>
phoe: Murray Gellman would turn in his grave. I men there is 'Three quarks for muster mark, though he doesn't have much of a bark. And what he has is beside the mark.'
<edgar-rft>
I think the deftype is missing the "... or more atoms" part
nij- has quit [Ping timeout: 264 seconds]
wacki has quit [Ping timeout: 264 seconds]
wacki has joined #commonlisp
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
Gleefre has joined #commonlisp
yitzi has quit [Remote host closed the connection]
traidare has quit [Ping timeout: 246 seconds]
<younder>
For the record CLtL2 list's 27 special forms. ANSI CL has 25
mgl has joined #commonlisp
monospod has quit [Remote host closed the connection]
occ has quit [Ping timeout: 246 seconds]
akoana has quit [Quit: leaving]
zetef has joined #commonlisp
occ has joined #commonlisp
lispmacs[work] has joined #commonlisp
<lispmacs[work]>
if you want to be able to print out a nice, transparent representation of your class, how should you go about that? Do you reimplement princ or write or something?
<lispmacs[work]>
representation of an instance of the class, I meant
<pve>
lispmacs[work]: you could write a method for print-object
zetef has quit [Remote host closed the connection]
szkl has quit [Quit: Connection closed for inactivity]
Pixel_Outlaw has joined #commonlisp
<younder>
custom (defmethod print-object ((obj class) stream )) (print-unreadable-object) (obj stream: type t :identity t) (princ stuff stream)))
shka has quit [Ping timeout: 268 seconds]
<younder>
something along those lines
<scymtym>
if you want to include a lot of detail, maybe write a describe-object method. such a method is called from (describe INSTANCE-OF-YOUR-CLASS)
mgl has quit [Ping timeout: 268 seconds]
cage has quit [Quit: rcirc on GNU Emacs 29.2]
tyson2 has joined #commonlisp
pve has quit [Quit: leaving]
st_aldini1 has joined #commonlisp
danza has joined #commonlisp
st_aldini has quit [Ping timeout: 240 seconds]
st_aldini1 is now known as st_aldini
pfdietz has joined #commonlisp
dnhester` has quit [Ping timeout: 255 seconds]
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
tyson2 has quit [Remote host closed the connection]
danza has quit [Ping timeout: 255 seconds]
tisanae has joined #commonlisp
dnhester` has joined #commonlisp
josrr has quit [Remote host closed the connection]
jonatack has joined #commonlisp
josrr has joined #commonlisp
dnhester` has quit [Ping timeout: 264 seconds]
ymir has quit [Ping timeout: 255 seconds]
dnhester` has joined #commonlisp
nij- has joined #commonlisp
danza has joined #commonlisp
<nij->
mfiano item 2 touches on some more meta info, yes.. but still don't let us manipulate the environment. I wonder why..
<nij->
Environment as first-class object - is it hard to achieve? Or it's not adopted for other practical reasons?A
danza has quit [Ping timeout: 252 seconds]
<mfiano>
That is a topic beach may be able to answer, but I would suspect the answer is "yes, it's difficult", given the research and design going into SICL to support that.
josrr has quit [Remote host closed the connection]
<nij->
Hmm.. lemme ask it in #SICL.
josrr has joined #commonlisp
ymir has joined #commonlisp
jmdaemon has joined #commonlisp
son0p has joined #commonlisp
alcor has quit [Remote host closed the connection]
chomwitt has quit [Ping timeout: 256 seconds]
alcor has joined #commonlisp
dra has quit [Ping timeout: 268 seconds]
King_julian has quit [Ping timeout: 264 seconds]
alcor has quit [Remote host closed the connection]
dino_tutter has quit [Ping timeout: 272 seconds]
Gleefre has quit [Remote host closed the connection]