Gauche Devlog

< Almost there? | 0.9.4 is out! >


Keyword-symbol integration

Aargh, Already May? Unbelievable. Final stretch turned out to be a long marathon.

If you monitor github repo you know it's actively developed, though most changes are minor fixes. I cleared the items on the table I listed last time for 0.9.4 release, but I realized I left out one major item: Keywords.

Gauche has a keyword type, disjoint from other types. I think I inherited it from STk. I also speak Common Lisp and having :keyword is so natural that I tend to forget that treating keywords specially actually conflicts RnRS spec. In RnRS, they must be symbols.

In fact, it became an issue when we adopted srfi:42, in which symbols beginning with : is used. Alex Shinn employed a clever trick during macro expansion to work around the issue.

Now, with more R7RS libraries coming out, I expect this design would be a bigger obstacle.

Some implementations that have keywords avoid this conflict by adopting a syntax different from symbols, e.g. #:keyword. In fact, my original plan was to make the keyword syntax customizable, :keyword, #:keyword or even keyword: (DSSSL style; anybody remember?). That's why we don't have the colon in keyword's name slot. However, mixing these syntax is just confusing, and I strongly prefer :keyword anyway. #:keyword has a merit of not conflicting with symbols, but they are visually too intrusive, and it has been used as uninterned symbols in CL and Gauche.

Technically we don't need to make keywords separate from symbols; indeed, in CL, keywords are just symbols in the keyword package. We can just do the same:

  • We can make <keyword> a subtype of <symbol>. Identifiers beginning with ':' are read as an instance of <keyword>, but they're also symbols. So keyword? still works, but keywords also return #t for symbol?.
  • We can have gauche.keyword module, that acts as if it has constant bindings of every possible keywords, bound to itself. In reality, we create such bindings on the fly as keywords are read.
  • Then the gauche module can inherit gauche.keyword, so that existing usage of Gauche keywords will be preserved. They are symbols, but evaluate to themselves. It also allows programmers to rebind keywords (locally or at the toplevel of their modules) but the effect stays local, and those who conduct such an act should know what they are doing.
  • The r7rs module does not inherit gauche.keyword, hence symbols starting with : are just ordinary symbols. All portable R7RS code should run.
  • If one wish to use Gauche features and import gauche.core, the bindings of those keywords come with it, so you can call Gauche procedures with keyword arguments just like you're using Gauche.

This looks reasonable to me. There are a couple of catches, but I think they are minor and easily worked around:

  • If you import some of Gauche's procedures into R7RS code by (import (only (gauche core) foo ...)), keywords are not imported, so you should call it something like (foo ':bar b ...) i.e. quoting keywords.
  • If you import both an R7RS library that exports bindings of symbols that begins with : and gauche.core into R7RS code, whichever comes later would shadow the former. Generally you need to import gauche.core first.

However, this change needs to break the backward compatibility of certain cases, and it turned out it's a bit complicated. I'll describe it later.

Tags: r7rs, keyword

Past comment(s)

Miguel (2019/05/06 18:40:21):

I like it a lot xnxx tube The theoretical capacity of the current network is destroyed by mixing fast and slow trains on the same lines. For instance, on the &ldquo;fast&rdquo; lines out of Euston, stopping a through-train at a station, or running even the fastest suburban train, wipes out the next through-path, if not the next two.


Abraham (2019/05/10 06:25:41):

this is be cool 8) payday loans * Under pressure to provide healthier meals, McDonald's Corp announced on Thursday that it would no longer marketsome of its less nutritional options to children and said italso planned to include offerings of fruits and vegetables inmany of its adult menu combinations. ()


Archie (2019/05/10 06:25:44):

I've got a very weak signal installment loans It&#8217;s easy for people to judge others, like the two comments above, but neither has been deployed over seas and neither I&#8217;m sure have fought for this country in any matter whatsoever. The guy flipped out and lost himself, it happens. He should have used the insanity defense, he obviously did not have proper legal counsel. Maybe he can shack up with Chelsea Manning now at Levenworth and they both can keep the delusions alive. I feel bad for Bale&#8217;s wife and kids, they are the ones that are going to lose out, oh and also for all those Afghans that he maimed.


Brayden (2019/05/10 06:25:46):

Can you put it on the scales, please? fast cash loans Problem is, too many publishers (like EA) push the devs to release too early, which causes the end product to be garbage. As well, how much (in terms of percentage) of the total game profits reaches the developers?


Lily (2019/05/10 06:25:49):

perfect design thanks installment loans Kevin Bullock, of Bellevue, Idaho, watches smoke from the 64,000 acre Beaver Creek Fire on Friday, Aug., 16, 2013 north of Hailey, Idaho. A number of residential neighborhoods have been evacuated because of the blaze.(AP Photo/Times-News, Ashley Smith) MANDATORY CREDIT


Kareem (2019/05/10 06:25:51):

What's your number? cash advance "The Rolls Royce customer owns at least $30 million or hasfive or more super-luxury cars," said Minh Doan, head of RollsRoyce Motor Cars in Hanoi. "The fundamentals are sound for longterm growth and wealth creation for Vietnam's businesses."


Desmond (2019/05/10 06:25:55):

I'm sorry, I'm not interested fast cash loans But critics say the proposals are ill-timed. They would riskputting large numbers of mostly middle-aged men near peakearnings out of work just as the administration is trying tolift Japan from two decades of deflation and stagnant growth.The fired IBM workers are also middle aged.


Ivory (2019/05/20 00:46:48):

I'm doing a masters in law Manufacturing could get a boost from robust demand for trucks, thanks to a strengthening housing market. General Motors Co, Ford Motor Co and Chrysler Group reported strong truck sales in July. However, low inventory of some popular car models slowed automobile sales.


Wilmer (2019/05/20 00:46:50):

I'd like to open a business account al4a porn

  He secured the train at 11:25 p.m. on Friday, setting theair brakes and hand brakes, according to MMA. Burkhardt said theengineer set the brakes on all five locomotives at the front ofthe train, as well as brakes on a number of cars, in line withcompany policy. Four of the train's engines were switched off,but the front locomotive was left on to power the airbrakes. Theengineer, who Burkhardt declined to name, then retired to ahotel in Lac-Megantic.

Madeline (2019/05/20 00:46:53):

I can't get a signal kcm wallpaper may 2018 Chobanov said the government will target a lower fiscaldeficit next year of 1.8-2 percent of GDP against this year's 2percent and Bulgaria may seek up to 400 million euros ($540million) in a yet to be decided syndicated loan or eurobondlater this year.


Scotty (2019/05/20 00:46:55):

I've got a part-time job planetsuzy porndude Personal finance is far more complicated today than it was just a few decades ago. Growing up in the 1970s, my parents didn&rsquo;t have to worry about their credit score, which cellphone, cable and Internet package to choose, or whether to open a home equity line of credit (very few ever did back then). MasterCard was called Master Charge (it was renamed MasterCard in 1979), and most families I knew didn&rsquo;t carry a general purpose credit card anyway.


Erin (2019/05/20 00:46:59):

We were at school together “It’s obviously a black eye for him and a black eye for that franchise,” punter Steve Weatherford added. “It’s disappointing for him because we’re role models at this point in our career and we have a pedestal to inspire and motivate.”


Odell (2019/05/20 00:47:02):

I'd like , please nizagara 100mg side effects What must have inspired both cast and orchestra was Daniele Rustioni&rsquo;s super-charged conducting: from his smashing account of the overture (with its quaint quotation of the National Anthem) to the ringing final chords, he infused the drama with a hotly electrifying dynamism which the production sadly failed to match.


Danilo (2019/05/20 00:47:04):

I'm a trainee xnxxxx Increasingly aware of environmental safety, members of the Chinese public have been taking to the streets to oppose environmentally risky projects, and local governments have yielded under public pressure in some cases — by scrapping the projects, postponing them or relocating them.


Post a comment