-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Literal and Its Sub-Classes #15
Comments
Following up on the discussion on colouring schemes in #17 where we decided to remove all classes, even predefined ones, from the list of keywords. There is only two notations in the diagram that are required:
Yes, it says that, and only that. It does not say that you can subclass any of them. But literal already has two pre-defined sublclasses, literal and string. And you can But, yes, that could probably be explained further and exemplified. Are we keeping issues of this kind in this project or in the Alan tracker? |
Thanks for the clarification.
Here the issue concerns the Manual content updates (I'm adding them as commented TODOs in the Manual source files). I'm not sure what you mean by "the Alan tracker", you mean at Pivotal? |
Yes I meant Pivotal. It gets a little confusing to have multiple issue trackers for similar types of issues. Since changes to the language or IDE etc. will force updates to the documentation too. I'm thinking that issues here would primarily be around layout, formatting etc. But I also see that "bugs" in the documentation might go here. The tracker has been the one and only place for me to keep track of all Alan issues, but I suppose that to enable more collaborators around the documentation we should keep issues that are strictly about documentation here. Issues that change something which needs to be documented should start out in the tracker, and could later be transferred here, if the documentation was not done in direct conjunction to the implementation. (Technical Debt ;-) which we don't want...) |
If I'm not mistaken, Pivotal is not free. I remember looking into it when I discovered that Alan used it for tracking development, but then the registration form mentioned "Free for 30 days", so I desisted. I think that separating code and documentation issues might make sense, after all there are no real "bugs" in documents, only things to correct or improve (but a document won't crash). Possibly, contributors to documentation might get overwhelmed by bug tracking being in the same place. |
Actually, I think a problem with documentation is as much a bug as a problem with running applications, it's just a matter of what effects the "bug" will have. And that is a gray-scale if anything is. Bugs in documentation might have more severe consequences than code bugs. I surely don't pay anything ;-) And here's what they say:
But let's not jump the gun, we'll see how this evolves. |
Thanks for the info on Pivotal, it wasn't very clear from mere website navigation. I'll read the full details and open an account then, and try to get a grip on how it works. As for the documentation bugs in this repo vs Pivotal, another difference would be that this project will host also documents that don't belong to Alan's official documentation (the AlanIDE Guide is just one example), so the two project don't overlap 100%.
Then probably severe problems in the documentation should also be tracked on Pivotal, and in any case it's always possible to cross reference issues on the two platforms. The point here is that as far as documentation contributors are concerned, they'll need a GitHub account to contribute to the documents, while creating a Pivotal account would not benefit them in terms of contributing contents or editing (for example, I'll be creating a Pivotal account solely because Alan uses it to track issues). Not all Alan users are programmers, and for many of them asking them to use Git might be already a demanding task (can't say Git is a user friendly tool at all). |
You can probably get a fair grip of Pivotal by just navigating the Alan project, as it is open and you can see most fields, buttons and such (but not do much). We'll probably work it out once we see which issues show up. |
I've tried some tests with literals, and here is a working example:
From this I realized that This omission in the documentation is definitely a bug! Because of it, I never realized you could use Is there a file in the Alan source code that contains all the keywords and reserved words, which I could reference to double check that no keyword is left of in the highlighters? I was about to update the Alan syntax for Highlight (to move I'll wait for confirmation from you before updating the Highlight syntax and the XSLHL syntax used for creating the PDF Manual, just to ensure I get it all right this time. |
I have one further question about syntax highlighting Alan code, which I would like your advise on for I'm about to update also the Highlight syntax definition (but I would like to also apply this to the XSLHL syntax). Include
|
Here's a complete list of all tokens defined by the Alan language grammar. It currently includes
|
Three Missing Keywords!Thanks, this helped me a lot. After comparing the list you provided with the one in the Manual, I've actually found three missing keywords:
So I'll add these three to all the highlighters definition and also amend the keywords list in the Manual.
Yes, I must have got confused. Sometimes I try to think of them as "reserved words", at least when working with syntax definition where I have to consider any native token of the language. This also shows that my view on this is a bit biased by the highligters' work — I tend to look at the list in the Manual with my mind focused on the needs of creating a syntax definition, and I tend to forget that it's meant for readers who are only interested in learning the language. Keywords in Manual: CVS in TableBy the way, as a side note, now the keywords list in the Manual is handled via a table that takes a CSV list and auto-formats it into columns and rows: [[table-of-keywords]]
.List of Alan Language's Keywords
[format=csv,cols="5*m"]
|======================
actor
Add
After
As an added benefit, we could control the number of columns by a custom attribute, to make the table larger or thinner according to output format (eg, when targeting eBook Readers use 3 columns instead of 5). Also, we could import the keywords list from a CSV file instead of having the list inline — this would allow the CVS file to be placed in the assets folder and be reusable by other docs too. |
Highlight Syntax UpdatedI've update the Alan syntax for Highlight accordingly, and created a merge request; so these changes should be integrated into the next release. Ultimately, I've moved This afternoon I'll do the same with XSLHL syntax, and then try these styling changes:
The goal is to allow the reader to distinguish in the examples between what is hard-coded into Alan and what isn't, and using bold for predefined classes/instance could be a visually non intrusive reminder of that. Let's see how the final results looks; we have freedom to test various combinations until we're in the draft stage. It's a pity that XSHL doesn't supported escape sequences and interpolation inside strings (you can define an escape symbol, but it won't be styled in any way). In Highlight I implemented dollar special characters as escape sequences, and dollar parameters refernces as interpolation (did the same in Sublime Alan), and this makes strings look nicer, and also distinguished between special characters used for formatting from parameters subsitutions. I think that this is a quite cool feature, because the dollar special chars can make it hard to read strings, especially when there are many of them in one place. Hopefully we'll have that in the HTML format, via Rouge (or whatever other highlighter we end up using). |
- Alan XSHL: Fix syntax: - Add missing keywords: `meta`, `transitively`, `indirectly`. - Add `literal` to predefined classes. - Create new group `hero` for highligting `hero` instance (optional). - XSL Stylesheets: integrate new `hero` syntax element. - Add to `_dev/hl/syntax-highlighting.asciidoc` new code to test predefined classes and `hero`. (see #15 and #17 for details)
OK, I've fixed all the keywords and predefined classes in both the XSLHL syntax and in the Manual (not the keywords list of "D.2. Keywords" is stored in an external CSV file which is included into the document. I've also added Also, I've added to the Syntax Highlighting PDF document a code example containing all predefined classes and the All previous test commits have now been merged into |
Nice. In the Syntax Highlighting PDF I noticed that there was a "fiver" (5) that was coloured red. I would consider literal values and constants equal to author defined identifiers. They are values that can be used in expressions. I have noted that some colour schemes colour integers in a separate colour, maybe this was the case here? It wasn't exactly the same colour as keywords? |
Yes, I've added the possibility to highlight integers with a custom color, but I can just set it to normal color and hide it in the documentation.
Yes, indeed usually numerals are given a color of their own, it makes it easier to spot them in very long source files. But for the purposes of the Manual's example this might not be needed.
No, it's a bright red. Anyhow, as soon as I open again the XSL files I'll change it to normal. Then I'll start working on the Predefined classes diagram — I have drafted an SVG version using Mermaid, which produced the colored diagram image which I've posted above, but I'm not 100% happy with it, might just recreate it using Inkscape. |
Predfined Classes Diagram Ready!I've found an amazing open source tool for drawing diagrams, called Dia Diagram Editor. It's cross platform and comes with a nice GUI to draw lots of different types of diagrams, and it's also user extensible and there many more diagrams types contributed by users as plugins. (there is so much good to be sayed about this app that I better stop here, otherwise I could go on praysing it for ever! it really saved my day). I've used it to recreate the classes diagram, here is the SVG converted image: The coolest thing is that Dia can also be invoked as a CLI tool to automate conversion of the source diagrams to different output formats (and it really supports many formats!). In fact, I've added scripts to automate conversion and deployment of the diagram: Also, SVG images created via Dia show up nicely in PDF documents — unlike many of the Asciidoct Diagram tools, like mermaid, which I've tried to use but the SVG image they produced wouldn't show up correctly in the PDF file (corrupted colors, missing text). So, what you think of the new diagram? Does it look nice? Of course, being a vector image it can really scale well, losslessly. If you like the image as it is, the next step is to include it in both the Manual and the Beginner's Guide (both use this image). But I probably won't be able to do it before tomorrow. |
Alan XSLHL Stylesheet: set numbers color to normal. (reference: Issue #15)
Updated Classes Diagram in ManualI've added the SVG version of the predefined classes to the Manual (Live HTML link). It looks really nice in both the HTML and PDF versions. I've also added to the caption a note about the usage of different bg-colors in the diagram, but I'm not fully satisfied with the text:
For a caption text it might be too long, but at the same time is too short to explain the issue properly. In the PDF version the caption text uses a very big font compared to the HTML document. I've also fixed all occurences of literal classes to inline code style (whereas before I was rendering them in bold, thinking there were not reckognized). |
Fix list of Alan keywords and predefined classes. For more info see: alan-if/alan-docs#15 (comment)
This commit fixes some keywords issues and improves the syntax: - kwd-ID 1: Add missing Keywords: `indirectly`, `meta`, `transitively`. - kwd-ID 2: Add missing Prefefined Classes: `literal`, `string`. - Add new keywords group (ID 3) and move `hero` into it (from kwd-ID 2). For more details on these changes, see discussion with Alan develepor Thomas Nilefalk (@thoni56) at: alan-if/alan-docs#15 alan-if/alan-docs#17
Since the original topic of the diagram has been solved, and all the keywords issues have been resolved both in the Manual as in the syntax highlighters, I've created a separate issue (#22) for the implementation of more examples on using literals. So this issue can be closed. |
@thoni56, I have a few questions about the literal class and its subclasses.
The manual could be expanded a bit on this topic, especially by providing exmaples. So, I'll expose here my doubts and questions about them, and if you can help me cllarify the topic I could then try to edit the Manual accordingly (in a separate branch).
Classes and Keywords
One of the things that initially puzzled me most on literals is that while they all belong to the predefined classes not all of them have corresponding keywords:
As a matter a fact, I propose to change the image of the above diagram to use color and style to provide further information:
For, if I've understood correctly, while you can
ADD TO
the string class, you can't do that on literal and integer.The diagram is shown in Ch.2's The Predefined Classes, and adding the proposed color/style changes, and a description of their meaning in the image's caption, could help new users memorize better the base classes.
This is a first draft I was working on (but here I used red borders instead of italics for non-keyword classes):
But I think that using italics instead of red borders is better (especially for a printable version, where the dark red would be lost in print).
What do you think about the classes diagram tweaks? Should we use in the Manual?
(the image above is just a draft, I'll create a good SVG image).
Styling Issues
In various places I have problems when it comes to styling literals, since they are not Alan keywords in the strict sense I haven't styled them as
inline code
, but as bold. The problem is that when the text mentions all the predefined classes it becomes a mixture of inline-code and bold styles:In Ch.2's The Predefined Classes I haven't yet decide how to style this paragraph, and just left all classes in bold in this context:
... because if I were to follow strictly the conventions, it would like a bit hugly:
I think that styling convention should make like easier to the reader, but in some contexts we should also consider text elegance. As a general rule, when a keyword occurs multiple times in a paragraph, I only style it as inline code in its first occurence, or in those places where it's important to underline that we're dealing with the keyword, not just the general concept. Wherever the context is obvious, or when the keyword and its noun counterpart in the natural language overlap, I prefer not to use styles.
But in the above list of native classes, distinguishing between classes that have and don't have a keyword counterpart might actually help the reader, who might otherwise try to use
ADD TO
withliteral
andinteger
— here, styling them in bold will make them contrast with the other classes, although I admit it looks hugly.Any suggestions on this?
Examples Needed
The problem in the manual is that section 3.6. Instances/Literals is vague on the topic:
The last sentece really confuses me. Some examples here (or elsewhere, and just add a cross reference here) would help, otherwise the reader/learner is left with huge question mark floating in his head.
I've seen examples of verb additions to the string class (in the StdLib), but the above sentence clearly states that they can be added "to literal and its sub-classes".
Could you help me understand better this point?
I think that it's worth adding to the manual a couple of examples right after that sentence. So far, I can't recall finding in the manual practical examples on literal classes, but I might be wrong on this.
The text was updated successfully, but these errors were encountered: