freenode/#lisp - IRC Chatlog
Search
19:50:25
emaczen
Ok, I can successfully (#/initWithFrame: (#/alloc 'ns-text-field) (make-ns-rect 10 10 600 800)) and then
19:50:25
minion
emaczen, memo from fiddlerwoaroof: I've looked into Obj-C exceptions, but I don't think there's anything you can really do about them
19:50:25
minion
emaczen, memo from fiddlerwoaroof: see the recent-ish comments in #ccl from eschatologist
19:51:46
emaczen
I can draw this NSTextField to a window and everything works (I can type in it etc...)
19:53:19
emaczen
If I try the same with a NSTextView, Immediately after calling #/initWithFrame: I get signal 11
20:04:09
emaczen
minion: memo for fiddlerwoaroof: I briefly looked at NSException.h which has the macro definitions for exception handling, and it looked to me that all you have to do is just translate the macro definition into lisp
20:04:57
emaczen
minion: memo for fiddlerwoaroof: the translation entails defining the C struct for an execption and some function calls
20:32:22
emaczen
slyrus_: Yes, but I need to learn more about when and how to get control of the main thread
20:33:23
eschatologist
minion: memo for emaczen: Don't try to bridge NSException to Lisp, it'll only end in tears, Objective-C exceptions *are not meant* to be handled
20:33:25
emaczen
It appears that the CCL bridge is more tolerant of not executing GUI code on the main thread too
20:33:25
minion
emaczen, memo from eschatologist: Don't try to bridge NSException to Lisp, it'll only end in tears, Objective-C exceptions *are not meant* to be handled
20:34:35
eschatologist
It really sounds like you're trying to bridge NSException and Lisp conditions or something though.
20:34:59
eschatologist
Which, really, you can't. As soon as an NSException is raised/thrown, you need to treat process state as corrupt.
20:37:17
eschatologist
So when an exception is thrown none of the intervening stack frames etc. between the throw and the eventual catch are likely to do whatever housekeeping is needed to keep the process going.
20:37:45
eschatologist
(Trust me on this, 22 years of NeXT/Cocoa experience, and I've work on tools and frameworks at Apple.)
20:38:43
eschatologist
GNUstep is an entirely independent implementation but it almost certainly has all the same constraints.
20:39:38
eschatologist
Since none of the OpenStep APIs GNUstep implemented had any definition about exception safety, there's probably no consideration for it in the implementation.
20:40:52
eschatologist
That trivial-main-thread thing on Github also propagates a common myth, "only thread 0 is allowed to issue drawing calls." The reality is WAY more subtle and stating things in that fashion is likely to lead to people writing bad code. (E.g. people assuming things like "calls that don't draw are safe from multiple threads.")
20:41:42
emaczen
eschatologist: Yeah, which is why I couldn't just (#/initWithFrame: (#/alloc 'ns-text-view) (make-ns-rect 0 0 600 800))
20:43:17
emaczen
I'm using sb-thread:interrupt-thread (sb-thread:main-thread) (lambda () ...) and the equivalent ccl:process-run-function for CCL
20:44:35
eschatologist
The critical part is actually having a view in a window and having that window onscreen.
20:44:36
eschatologist
You don't manage the event loop yourself in Cocoa, the framework manages it for you.
20:44:55
jmercouris
eschatologist: not always, not when you have an opengl loop within a cocoa window
20:45:33
emaczen
eschatologist: I only briefly looked at the CCL bridge and to me it looked like they subclassed NSApplication and defined a selector called #/lispInterrupt
20:48:08
emaczen
eschatologist: Well, what are other possible reasons that nothing happens to my window when I create an NSTextView and then send #/addSubview or #/setContentView appropriately?
20:54:34
emaczen
If I uncomment the lines regarding the NSTextView, I can have an NSTextView in my window
20:55:00
emaczen
I want to just run the code as is, and then create the NSTextView and add it to the window from the REPL
21:00:03
eschatologist
Are you creating the NSTextView and setting your window's contentView from within the main thread?
21:03:00
emaczen
eschatologist: The result of evaluating that in the REPL is nothing on the window, and no logs in *inferior-lisp* either
21:03:08
eschatologist
Yeah, can't tell you why that wouldn't work. I assume you know that an NSTextView isn't a complete text stack with a scroll view, clip view, etc. like you'd get in a xib file, right?
21:04:28
emaczen
But I think I know what you mean since I have manually added a NSScrollView etc to a NSTextView before
21:04:48
eschatologist
(Also the Lisp bridges really need to update to using libclang to parse the modern headers or something so they can do things like `(setf (window contentView) textView)` instead of having use #/ to explicitly call setters.
21:06:35
eschatologist
emaczen: I would suggest in the strongest possible terms that you work through a couple Cocoa-with-Xcode-on-macOS tutorials using Interface Builder and so on. NeXT's frameworks were always very opinionated about how you should work with them and Apple has continued that tradition, and trying to work in a different way will be fighting them.
21:06:52
eschatologist
That doesn't mean you need to use Interface Builder for your own stuff, but it does mean you need to know everything that IB is doing for you, intimately, so you can do it yourself.
21:12:50
eschatologist
One thing I'd notice as an IB user is that I *never set the contentView of a window*.
21:17:37
emaczen
I think this is a thread problem because if I just put a (format t ....) form as the first form in the body of the (with-main-thread ...) I never see anything printed...
21:22:21
fouric
no-defun-allowed: cool! now, does that mean that i can actually COMPILE two files in two threads simultaneously, or is still a ways off?
21:33:29
moldybits
i want to make a new list of N elements, each provided by a procedure, like: (make-list 3 :initial-element-producer (lambda () (random 10))) => (4 7 2) ; what's the canonical lisp way?
22:18:08
aeth
verisimilitude: At that point you might as well just (lambda () (random 10)) as the function
22:32:22
makomo
what's the usual idiom when you want to "merge" multiple "multiple values"? e.g. i would like for (values mvs1 mvs2) to merge all of the multiple values returned by mvs1 and mvs2 and return them all as multiple values
22:35:07
aeth
verisimilitude: Clever code is generally discouraged in any language. Except maybe Perl.
22:40:04
aeth
Is a "hey look how cool this language is" demo posted on a blog what you'd typically see in production, though?
22:40:22
verisimilitude
No; it's my understanding you usually get an uninteresting mess in production.
23:13:50
jasom
I've seen clever code in production; fortunately it was well commented. It also wasn't more clever than necessary
23:37:13
jmercouris
has anyone figured out how to get slime to avoid opening new windows and randomly moving things around?
23:37:32
jmercouris
I looked at using shackle, but slime makes several buffers and windows, so I am not sure how to configure it
23:41:30
jmercouris
I literally have to register my window configuration every time I am about to open up slime because I know it will ruin everything
0:52:57
ym
For example, I have a class with array-slot and type of elements of this slot may be set with initialization or may be derived wile initialization. Then I want to have a slot containing a type which was set with make-instance.
0:55:16
gilberth
A very bold way, would be: (defun my-type-specifier-p (type) (not (nth-value 1 (ignore-errors (typep nil type)))))
0:56:59
Bike
typep has undefined effects if you don't give it a type specifier. it might not signal an error.
1:08:48
stevencc
what's wrong with "Unexpected HTTP status" when i run (ql:quickload 'repl-utilities)? anyone can help me?
2:59:12
Ukari
would it hurt the performance if I use a :include option in (defstruct (bar (:include foo))) to make "bar" as the nickname to export in package instead of "foo"?
4:54:02
emaczen
eschatologist: Can you elaborate on what code should be called from the main thread and what code should not?
5:11:11
gilberth
Not all the time, when I am awak, you sleep, when I sleep you are awake. Seems like we do not share a common time zone ;-)
5:12:17
gilberth
But, yes. I figure that the last key, I will ever type will be the ")" key. You need to close your parens after all.
5:14:40
gilberth
Ask me in two years or so. I am currently into implementing an electrial CAD application, which will be cloud-based and a web application. So I am more into JS right now. But I figure, that JS would seriously need an SEXP-based syntax.
5:15:57
gilberth
Na, this is not paid. I pay myself. Perhaps I could make some money from that, who knows?
5:17:31
gilberth
Seriously, I want Common Lisp special forms for JavaScript. Like, you don't care if a GO (sic!) is non-local or not. And I miss the parens.
5:20:30
gilberth
I am still pretty much into Common Lisp. There is a pile of projects waiting to be published, but I still suffer from my illness.
5:21:53
beach
gilberth: I have decided to take some time to split off "modules" of SICL into independent libraries.
5:22:13
beach
I am working on the environment protocol at the moment: http://metamodular.com/trucler.pdf
5:22:26
gilberth
But then, I wanted to have a good electrical CAD system for more then ten years. Currently a pet project of mine is to build a 32-bit RISC CPU from 74xx devices, so I have use for that. And a modern cloud-based E-Cad system would perhaps be something to make money with.
5:23:27
gilberth
lambda-list parsing is "fun". There are so many variations of lambda lists in the CL spec.
5:27:26
gilberth
I see. Does it solve the problem that you usually cannot name the exact position of an atom?
5:29:15
beach
We take the "raw" S-expression from the CST, run it through the macro expander, then reconstruct a CST by looking for expressions in the expansion.
5:30:01
beach
But scymtym has plans for a special macro-expansion evaluator that uses CSTs throughout.
5:30:34
gilberth
Had you any luck to parse the dpANS spec? I was contemplating for some time to offer an annotatable ANSI spec.
5:31:11
beach
I have attempted to make a single LaTeX document out of the separate ones, but it's a mess.
5:32:40
beach
https://github.com/robert-strandh/Well-Specified-Common-Lisp in case you don't know about WSCL.
5:34:23
beach
In case you are interested, some of us hang out in #sicl where I can intervene more freely without risking to be kicked for off-topic stuff.
5:37:20
beach
Yeah, my plan is to turn it into a single LaTeX document, then start editing it while preserving the old text as footnotes or appendices.
5:39:46
beach
gilberth: Great progress is being made. A significant number of people are making good progress on McCLIM. Bike is working on the Cleavir compiler framework. heisig is doing the SICL sequence functions and more. And scymtym is doing lots of library stuff disguised as work on a very powerful IDE for Common Lisp.
6:00:49
malice`
Is there some grammar or other definition of possible CL's symbol names? regex would be awesome
6:07:47
minion
fiddlerwoaroof, memo from emaczen: I briefly looked at NSException.h which has the macro definitions for exception handling, and it looked to me that all you have to do is just translate the macro definition into lisp
6:07:47
minion
fiddlerwoaroof, memo from emaczen: the translation entails defining the C struct for an execption and some function calls
6:14:40
no-defun-allowed
malice`: any string can be a SYMBOL-NAME, but the printed form is a little different, lemme see
6:27:50
akater
Bike: why *wouldn't* one want to be able to classify objects at hand, including type specifiers? Class introspection (i.e., MOP) is useful, shouldn't type introspection be useful as well?
6:28:48
akater
I don't have a good use case example but I prefer declaring types, and for type specifiers I can't (yet) do that.
6:42:00
beach
malice`: Even if you just mean what can be read as a symbol, there is no regular expression for it.
6:44:24
beach
Again, if you just mean what can be read as a symbol, you will find the definition here: http://www.lispworks.com/documentation/HyperSpec/Body/02_cd.htm
6:46:42
malice`
beach: I am trying to write TextMate grammar for CL. I think I'll go with something basic like "anything not whitespace or between ||"
6:49:09
beach
I created a grammar for Common Lisp for (first) Climacs so that I could parse buffers containing Common Lisp code, but, again, it is a gross approximation. That's why, for Second Climacs, I am using a version of the Common Lisp READ function to parse the buffer contents. Then it will be very precise.
7:00:55
pjb
akater: type specifiers are not objects. They're specifiers for virtual objects: types are not first class objects in CL.
7:01:41
pjb
(defclass foo () ()) (find-class 'foo) #| --> #<standard-class foo> |# (deftype bar () '(member bar)) (find-type 'bar) #| ERROR: Undefined function find-type called with arguments (bar) . |#
7:21:19
ym
Are sharplispers in the chat? I'm using last CLX from quicklisp, having an issue, but not sure why can't I find similar code on github even taking in account modifying date. The file is clx.lisp in root project directory. On my host system there is missing ":initarg :visual-info" slot parameters in colormap class definition (IIUC), though there is no such place in gethub version.