This is an old one, and I knew of cause that one should not use But that is was this bad to use Best, Kasper |
Yes, but the real question is: What is the lower bound? When would you consider it pointless to use streams and just concatenate away? Or even trying to profile the difference. For me, 3 or less. Vince From: Pharo-users [mailto:[hidden email]]
On Behalf Of Kasper Østerbye EXTERNAL: Do not click links or open attachments if you do not recognize the sender. This is an old one, and I knew of cause that one should not use
But
that is was this bad to use Best, Kasper |
When is it pointless to introduce a WriteStream and just use #, ?
When #, would not be in a loop or recursion. Constructing error messages, class initialisation code, that sort of thing. If you find yourself doing a lot of concatenations, you are probably missing an abstraction. For example, building up XML by string concatenation would be very silly: you want to build a tree and have it write itself to a stream. |
> On 18 Oct 2019, at 07:59, Richard O'Keefe <[hidden email]> wrote: > > When is it pointless to introduce a WriteStream and just use #, ? > When #, would not be in a loop or recursion. > Constructing error messages, class initialisation code, that sort of thing. > > If you find yourself doing a lot of concatenations, you are probably > missing an abstraction. For example, building up XML by string > concatenation would be very silly: you want to build a tree and have > it write itself to a stream. +100 |
In reply to this post by Richard O'Keefe
On 18 October 2019 at 08.00.13, Richard O'Keefe ([hidden email]) wrote:
Absolutely agree. Streams use logarithmic extension of buffer, concatenation linear, but it is still amazing to see. I am working on a pillar to `Text` generator. Here I found concatenation to be simpler to handle as I can add bold, italics, indentation, etc. in a much simpler way. To use a streaming method I would have to introduce both Canvas and Aggregate brushes. Doable indeed, but much less concise. Best, Kasper |
In reply to this post by vince
Sounds about right. Or if it fits within a line. Or if it makes the code significantly easier to read. Best, Kasper |
In reply to this post by Kasper Osterbye
I started to do exactly the same. Well I started to do a converter between pillar markup and text attributes, but I think you do the same. We probably should talk. Is you code anywhere public? Norbert
|
On 19 October 2019 at 10.51.53, Norbert Hartl ([hidden email]) wrote:
I have the basic pillar rendering done: headers, lists, bold, emphasis, images, links (including a “open browser on method” link). My main remaining issue is to do tables somehow. Any hints on how to render tables inside a text? It is not on github atm - I need a pull request to come through there before I can be a modular extension. I’ll try to get it up on my own github sometime Monday. I am currently working on a github markdown -> pillar tree (the internal rep of pillar). I estimate I am a few days out from that one. Best, Kasper |
On Sat, Oct 19, 2019 at 04:39:21AM -0700, Kasper Østerbye wrote:
> I am currently working on a github markdown -> pillar tree (the internal > rep of pillar). I estimate I am a few days out from that one. Are you doing this in pure Pharo? I have wrapped libhoedown, a Markdown to HTML library. libhoedown uses callbacks to invoke its renderer and I started constructing a Markdown to Pillar (string, not object tree) renderer by having libhoedown call back into Pharo. Pierce |
On 20 October 2019 at 09.11.06, Pierce Ng ([hidden email]) wrote:
Yes. I want to be able to render it inside the image windows.
I do understand you not wanting to write your own parser, it is a pest! However, I want a simple distribution model with no external dependencies. At the moment I have a working github-markdown parser (written in Pharo) which recognises: Blocks: headers, paragraphs, ordered and unorderd (nested) lists, block, code-blocs. Inline: bold, italics, overstrike, inline-code. I want links and images before releasing it as version 1. It is restrictive and is a bit peculiar regarding indentation and a few other things. — Kasper |
In reply to this post by Kasper Osterbye
On Sat, Oct 19, 2019 at 1:40 PM Kasper Østerbye <[hidden email]> wrote:
Hi Kasper, some intuition from my part for this. What if instead of putting tables into text you put text into tables ;). In other words, think both text and tables as renderable elements (cof cof morphs). Then, since we can make a morph from a text, and a table morph, then both can be combined. Cheers, Guille |
On 21 October 2019 at 16.17.49, Guillermo Polito ([hidden email]) wrote:
Out of the table thinking :-) So by putting a table on the outside, I can make the normal paragraphs individual rows of one column? To make an actual table, it would be some rows with more columns than one? Do the tables morphs allow for merged cells? I will look into it, but I am not too optimistic that I will be able to get anything that looks nice. Best, Kasper |
Free forum by Nabble | Edit this page |