New design for friendlybit coming up
New design for friendlybit coming up
Hi. I just wanted to tell you that I’m now working on the new friendlybit. I’ve listened to your previous comments, and these are the changes I’m going to make/not make: Blog format stays, no community. You’re damn conservative (something like 95% percent said to keep it a blog). More compact writing. I’ll skip more of the […]
Media attribute - what have you done for me lately?
I’ve been thinking for a while about the media attribute on link tags. Some people might find that thinking deep thoughts about HTML attributes is kind of strange, but I know you, my dear readers, know the feeling
An example, just so I know we’re on the same page:
This […]
Podcast Recommendation: Boagworld
As many of you know, I have something of a podcast addiction. My iPod contains everything from the video mischief of Mr. Deity to the probing intellectual discussions of In Our Time–which returns from summer hiatus this week. I listen to these while walking about campus, driving around town or when trying to fall asleep at night. Alas some of these podcasts are ill-suited to the fight against insomnia. Instead of lulling me into slumber, they taunt me with ideas that I want to tinker with right away. One such Podcast is Boagworld, “the podcast for those involved in designing, developing and running Web sites.”
As many of you know, I have something of a podcast addiction. My iPod contains everything from the video mischief of Mr. Deity to the probing intellectual discussions of In Our Time—which returns from summer hiatus this week. I listen to these while walking about campus, driving around town or when trying to fall asleep at night. Alas some of these podcasts are ill-suited to the fight against insomnia. Instead of lulling me into slumber, they taunt me with ideas that I want to tinker with right away. One such Podcast is Boagworld, “the podcast for those involved in designing, developing and running Web sites.”
Boagworld is the creation of Paul Boag and Marcus Lillington, co-founders (along with Chris Scott) of Headscape, a Web design firm in the U. K. According to their Web site, “Boagworld.com aims to educate you about the latest web innovations, teach you how to manage the development of your site and show you how to integrate your site into your broader business. Most of all it aims to put you in a position where you are not baffled by the techies who are building your site!”
Why you should listen to Boagworld
Two things struck me the first time I listened to Boagworld. 1) They’re quite entertaining, and 2) They really know what they are talking about. As soon as I heard them referring to such tried and true resources as A List Apart and Case alumnus, Eric Meyer, I knew they were on the right track. A visit to their well-organized, standards-compliant site served to confirm that they practice what they preach.
The podcasts cover a nice cross-section of topics aimed towards designers, developers, marketers and anyone else who is involved in some aspect of an organizations Web presence. As the mission statements says, “This site/podcast exists to help you poor sods who have been lumbered with the job of managing the company’s website. This responsibility is on top of your normal work and has been given to you despite the fact that you know little or nothing about the internet and building websites. It is for you that boagworld.com exists.” (I told you they were entertaining.) Shows are 50-60 minutes in length and typically feature:
- Light hearted banter between Paul and Marcus as they share the week’s Web-related news, tips, advice and recommendations
- Marcus’s Bit, typically focusing on an issue related to Web project/client management or marketing
- Paul’s Corner, covering a design or development subject, and
- Interviews with various experts, such as Patrick McNeil from Design Meltdown and Daniel Burka, the creative director at digg.com and/or book reviews
The order of the above may vary, but each week they cover a wide range of material on everything from css to social media.
Why you should read Boagworld
One of the problems with audio podcasts is keeping track of the names, links, books and other details mentioned throughout the show. This is not a problem with Boagworld as the accompanying Web site and blog includes summaries and/or transcripts of the shows including links to everything mentioned within. Rather than having to listen with pencil and paper at the ready, you can simply relax with the audio then go to the site later to follow-up on their recommendations. Archives are organized by date and subject as well as tagged by keyword, making the information easily accessible even if you can’t remember which episode featured what. The blog allows listeners to leave comments about the shows and the site also features a discussion board for further interaction with the hosts and other Web developers around the world.
Why are you still reading this? Go give it a listen!
At this point in this entry I could prattle on with various details and examples, but as I’m recommending that you listen to Boagworld, perhaps it is time that I let you do just that.
Happy Holidays from SitePoint!
As I write this, most of Team SitePoint is up on the 3rd floor partying down in style. It’s the end of a big year for us, and we’ve got a lot to celebrate … but of course there’s also plenty to look forward to in the year ahead! In 2008, you can expect the following […]
As I write this, most of Team SitePoint is up on the 3rd floor partying down in style. It’s the end of a big year for us, and we’ve got a lot to celebrate … but of course there’s also plenty to look forward to in the year ahead!
In 2008, you can expect the following from SitePoint:
- 99designs
The new incarnation of SitePoint Design Contests that we launched this year has been so successful that we feel it’s time it was set free to make its own way in the world. This active design community will be split off onto its own site and renamed to ‘99designs’.
Of course, this rebranding will come with a whole new visual design for the site. Watch for us to run a contest in the SitePoint Design Contests community to design the 99designs logo!
- The SitePoint Reference
Our CSS Reference site is already in closed beta, and we’re getting loads of great feedback from the SitePoint forum community. Early in 2008, this ‘reference to end all CSS references’ will open its doors to the world, and will be closely followed by references for HTML and JavaScript … each written by some of the foremost authorities on each technology.
- More great books
Our first title for 2008 will be The Art & Science of JavaScript, brought to you by a star-studded team of JavaScript experts.
- …and lots more!
SitePoint HQ is shutting its doors as we all take some time off over the holiday season. We’ve got some great articles queued up to go live while we’re away, and a few of our regular bloggers will no doubt chime in with any breaking news, but otherwise it may be a bit quiet around here for the next week. Rest assured, we’re just saving up some energy for the exciting year ahead!
See you in 2008…
This article provided by sitepoint.com.
Safari now available on Windows
Hi, this is just a short post to let you know that Safari is now available on windows. It’s was unveiled at the World Wide Developer Conference 2007 by Steve jobs himself. I can’t stress enough how important this is for all Safari users. Most developers still use Windows when developing web sites (it’s changing, […]
Opera’s Antitrust Complaint: Microsoft Must Support Standards
Opera has filed an antitrust complaint with the European Commission against Microsoft, alleging that Microsoft has illegally stifled competition in the browser market by tying Internet Explorer to Windows and by failing to support web standards. If this all sounds a little familiar to you, it’s because Microsoft fought a similar battle with the U.S. Department […]
Opera has filed an antitrust complaint with the European Commission against Microsoft, alleging that Microsoft has illegally stifled competition in the browser market by tying Internet Explorer to Windows and by failing to support web standards.
If this all sounds a little familiar to you, it’s because Microsoft fought a similar battle with the U.S. Department of Justice in 2001 and lost. Based on that ruling, Microsoft went to work making it possible for all of the bundled applications within Windows to be overridden by 3rd party alternatives. This facility exists today in the form of the Set Default Programs application in Windows XP and Windows Vista.

While these measures have satisfied the U.S. Department of Justice, they have not satisfied the European courts. According to Opera’s press release, in September the European Court of First Instance ruled that Microsoft has illegally tied Windows Media Player to Windows, despite the ability to override the program’s file associations using the Set Default Programs facility in Windows, and despite the availability in Europe of Microsoft’s special ‘N’ editions of Windows, which do not include Windows Media Player, as required by a 2005 European Commission decision.
Off the back of this latest ruling, Opera is seeking to have the Commission apply the very same logic to Internet Explorer, and force Microsoft to distribute Windows either without Internet Explorer (something that Microsoft has consistently maintained is impossible in practice), or with alternative browsers bundled in.
On top of the bundling issue, Opera’s complaint also seeks to require Microsoft to implement support for web standards in Internet Explorer. This will be a much tougher one to prove. Although Internet Explorer is certainly the least standards-compliant of the major browsers today, each and every release of Internet Explorer has included improved standards support. It seems that Opera is saying that Microsoft’s slowness to develop Internet Explorer is in itself an illegal and anti-competitive act.
So what do you think? Is Microsoft doing enough to enable users to choose alternative browsers in Windows? And should browser makers be legally required to support web standards, whether they have the programming resources to devote to doing so or not?
This article provided by sitepoint.com.
Min-width and Max-width template
Some problems seem to appear again and again, and one of them is page width. How wide should a site be? Should you adapt to 800px resolution? 1024px? Fully fluid with percentages? Perhaps elastic using em-units? There are lots to choose from. What I’ve found is that there’s one solution that almost always works. You […]
IE8 renders the acid 2 test
I’m not sure why I don’t see that many people talking about the fact that IE8 renders the acid 2 test perfectly now. It really seems Microsoft is starting to move forward again, after starting to feel some pressure from the open source world. Will they be able to pick up the speed needed to […]
Visual Studio 2008 Review
I know it’s a bit late, but as promised here’s a review of Visual Studio 2008. I’ve had it for a while now, but I wanted to wait until I’d worked on a few projects with it before I offered my opinion. Overall, it’s a solid improvement over 2005. The guys at Microsoft have made some good changes that actually improved the development experience rather than just adding a bunch of fluff.
I know it’s a bit late, but as promised here’s a review of Visual Studio 2008. I’ve had it for a while now, but I wanted to wait until I’d worked on a few projects with it before I offered my opinion.
Overall, it’s a solid improvement over 2005. The guys at Microsoft have made some good changes that actually improved the development experience rather than just adding a bunch of fluff. Unlike 2005, you’re not required to upgrade to the newest framework to use it, so you don’t have to upgrade to .NET 3.5 just yet. The IDE is generally a bit faster than 2005 and several of the features that were a headache for my team in 2005 have been made useful. The 2 most notable improvements were support for nested master pages in design view and a huge performance improvement in the table adapter editing interface.
One of the first things I noticed about the interface is the influence from Expression Web. There is a new split view for the designer and several new CSS helper tools. The split view has been in other products, like Dreamweaver, for ages and I have generally not found it very useful and initially, I felt the same way about the split view in Visual Studio. It really doesn’t help much when laying out your pages, but when writing code-behinds, it provides a much quick method for reviewing the layout and server control properties. The CSS tools, much like Expression, seem like they may be useful to those inexperienced with CSS, but for me they were more of a hindrance than help.
The biggest improvement is the javascript support. The support for the ASP.NET AJAX extensions is much improved, but that’s pretty much expected. What surprised me is the extensive intellisense support for javascript. It not only picks up the built-in javascript functions, it provides intellisense for any of your custom functions and variables. While my javascript skills are about average, our dedicated AJAX guy just wouldn’t shut up about how good the new javascript support is, which tells me it’s pretty solid. The new javascript debugging support is nice too, but it requires that you turn on the script debugger in IE, which makes any browsing outside of debugging your apps a pain.
Visual Studio 2008 is a nice step forward for Visual Studio. While some people were hoping for more features, the features that made it in are solid and the overall performance in improved. The javascript intellisense and debugging alone will make it worth getting for anybody working heavily with AJAX and the performance tweaks will satisfy impatient coders like me. There are a few shortcomings (it’s still a memory hog) but the improvements are well worth the upgrade.
This article provided by sitepoint.com.
An Introduction to Web Standards
I’ve recently come to the conclusion that a great number of Web developers either don’t know about Web standards, or simply don’t care. For those who aren’t already aware of the standards I’ll offer a brief introduction along with resources for additional information. For those who don’t care, or who are anti-standards, I’ll offer some examples as to why I feel they’re important.

Standards are simply
the rules of the road for the Web
I’ve recently come to the conclusion that a great number of Web developers either don’t know about Web standards, or simply don’t care. For those who aren’t already aware of the standards I’ll offer a brief introduction along with resources for additional information. For those who don’t care, or who are anti-standards, I’ll offer some examples as to why I feel they’re important. For those of you already in the know, feel free to add your own advice, examples or pet peeves in the comments section.
The reason for Web Standards
According to the Web Standards Project Mission, “The World Wide Web Consortium (W3C), along with other groups and standards bodies, has established technologies for creating and interpreting web-based content. These technologies, which we call “web standards,” are carefully designed to deliver the greatest benefits to the greatest number of web users while ensuring the long-term viability of any document published on the Web.”
Think of these as the rules of the road. When you are driving a car in Ohio you know you have to drive on the right side of the road, stop at stop signs, not enter an intersection unless there is room for your vehicle on the other side, yield to pedestrians, etc. If you are driving in Hong Kong you know to drive on the left and follow the various rules relevant to that jurisdiction. Following these rules makes the driving experience more pleasant for everyone; whereas ignoring these rules will, at best, annoy other drivers and, at worst, cause a traffic related fatality.
In most cases, a non-standard Web site isn’t likely to cause fatalities, but anything is in the realm of possibility. Errors in formatting can cause content to render incorrectly. Imagine if the word “Never” wasn’t visible to users reading the sentence “Never pour gasoline on an open fire.” A reader unfamiliar with the combustible nature of rising gasoline vapors could easily immolate himself. That’s an extreme example, but whether your site is about fire prevention or your book club, you probably don’t intend to misinform or confuse your readers.
Following Web standards lets you increase the odds* that your site will be properly rendered by most browsers and user agents and that your information will be more accessible to users and search engines.
* I say “increase the odds” rather than “guarantee” because there are still differences between the way browsers interpret the standards.
What are the Web Standards?
Different standards are available for different purposes, but for the most part standards will define the type of coding that you should use when creating a Web page or stylesheet, or the procedures or policies you should consider when creating the site. Thus if you are building a site in HTML using Cascading Style Sheets, and want to ensure your site is Section 508 compliant for accessibility, you might follow the standards for HTML 4.01, CSS 2, and Section 508.
For example, HTML standards specify using
to start a paragraph,
for a primary header and for emphasis. CSS standards specify things like color and position, so that a purple header could be defined in a stylesheet by: h1 {color:#571963}. Using a descriptive word or phrase in the alt tag of images conforms to accessibility standards (both 508 and WAI).
One of the most overlooked HTML standards seems to be the inclusion of the correct document type. For example, if you are building a site using XHTML 1.0 (as is true of many Case sites) you would include this document type:
This small piece of code tells browsers and user agents what version of HTML you are using, so they don’t have to guess when rendering the site. This is like telling Babel Fish whether you want to translate a phrase from Dutch to English or from German to English. If you don’t give it the right information you may not get the right result. I’m amazed by the number of sites don’t include this basic information.
Another important standard for HTML 4.01 and XHTML 1.0 is the separation of format and presentation.
Headline
is an example of format, indicating that something is a header. Styling the
with CSS, either in the document or in an external stylesheet, to be a certain size, color and font would be an example of presentation. In the old days of the Web this was done within the HTML using the now deprecated tag. In the past one might have typed
Headline
. This not only filled up your page with a lot of extra code, but it also meant that if you decided later to make all of your
’s a different color you would have to go and change all of the font codes one by one. When using a style sheet you can define how your
’s will look in one place. To change the color you just make the one change in the stylesheet and you are ready to go.
Separation of format and presentation isn’t a particularly new idea, but adoption has spread slowly. CSS 1 was first introduced in 1996 and the CSS 2 recommendation has been around since 1998. While many sites use CSS, it is still not uncommon to stumble upon current sites that are still using older codes such as .
Why this has been on my mind
A few weeks ago a friend sent me a link to a pretty cool looking site for an online magazine. Alas the site wasn’t standards compliant and therefore didn’t work properly. This particular site was Flash-based with dimensions too big to fit my screen. The page had no scroll bars so I couldn’t get to the menus to navigate through the site. I could see the whole site on my Mac, but not on my Dell, and I’m pretty sure I’m not the only one to have had that problem. Since I couldn’t navigate the site, they might as well have posted a page that said “Do Not Enter. We don’t care about your business.” If they had built a compliant site they would have ensured greater accessibility to users and not had this problem.
I’ve found a number of other non-compliant sites while working to compile a list of local Web developers. Departments without Web staff often look to outsource their Web projects and turn to me for referrals. Thus I’m trying to put together a list of local (to support the regional economy) developers who I can trust to build compliant sites that follow the Case design scheme, maintain a logical navigational structure and support the goals of the client. This has not been an easy task.
The problem is that almost anyone can learn to build a Web site, but only a few can do it well. There are a lot of firms out there, but the quality of work varies dramatically, and only a handful build standards compliant sites. Sites with major compliance errors don’t end up on my list. This isn’t just because I’m persnickety. If a site fails validation because of a few stray &’s or they’ve forgotten to close a few
’s I’m not worried. Such errors are easily corrected and don’t disturb the overall functionality of the site. But if a site uses tags, doesn’t include a doctype, leaves alt tags blank on all of their images, etc., then I will conclude that its designers are not professional and will not be able to offer the client the advice or service necessary to implement a successful site.
Conclusion and Disclaimer
If you’ve ever built a Web site, you’ve followed at least a few of the standards. The site wouldn’t work if you hadn’t. For example if you left out the
tag your page wouldn’t render. Since we’re all following some of the standards anyway, I would just encourage everyone to learn and apply more of them. As you become more familiar with them you’ll find that your sites become both easier to use and easier to build. To learn more about Web standards visit The Web Standards Project and the resources below.
Standards compliance is an ongoing goal of mine, but I’m only human. Not every site I’ve built is standards compliant, and the errors become more egregious the older the pages may be. Since I readily acknowledge this you don’t need to go hunt them down, they are out there, and I know it!
Web Standards Resources
- Asterisk Web Standards Archive
- Designing With Web Standards, Second Edition by Jeffrey Zeldman
- Jeffrey Zeldman: King of Web Standards (Business Week)
- Section 508: The Road to Accessibility
- The Web Standards Group
- The Web Standards Project
- W3C Cascading Style Sheets, level 2 CSS2 Specification
- W3C Cascading Style Sheets, level 1
- W3C HTML 3.2 Reference Specification
- W3C HTML 4.01 Specification
- W3C XHTML™ 1.0 The Extensible HyperText Markup Language (Second Edition)
- W3C Technical Reports and Publications
- Web Accessibility Initiative (WAI)
- World Wide Web Consortium (W3C)
What italic means
Finally an image that dispells all myths about the element. As you can see it’s all about presentation. Disappear you foul demon! (You have more HTML humor? Show me in the comments)
Quick Accessibility Testing
A recent project of mine required me to do a quick review of the accessibility level of a site. Nothing serious, just to show what was possible to test and where the site scored right now. I managed to assemble a small list of tools that I believe did a rather good job. This article […]
CSS3 Media queries instead of the media attribute
In my previous post about the media attribute I talked about how strange the media attribute is, and that its usefulness isn’t that obvious. As a followup I want to point you to an article that Russell Beattie wrote about CSS3 media queries. Media queries are a way to check the capabilities of a user-agent […]
Clarke Calls for CSS Working Group to be Disbanded
Having recently announced the CSS Eleven initiative to provide designer feedback and input into the W3C’s CSS Working Group, Andy Clarke has responded to the Opera-Microsoft antitrust action by calling for the Group to be dissolved entirely and rebuilt without browser vendors in a controlling role. He considers this necessary not only […]
Having recently announced the CSS Eleven initiative to provide designer feedback and input into the W3C’s CSS Working Group, Andy Clarke has responded to the Opera-Microsoft antitrust action by calling for the Group to be dissolved entirely and rebuilt without browser vendors in a controlling role.
He considers this necessary not only because he doubts that the representatives of Opera and Microsoft can collaborate on CSS3 while locked in a legal battle, but also because he feels it’s time the future of web standards was led by those of us who will eventually use them in our daily work, not those who hope to make money by making browsers.
Clarke’s indictment of Opera’s legal action has been echoed by many in the web design community. CSS expert Eric Meyer considers the Opera move to be bad timing, coming right when Microsoft was showing promise with IE7 and the upcoming IE8:
It’s the wrong move at the wrong time, sending precisely the wrong signal to Microsoft about the importance of participating in development and support of open standards, and I can only hope that it comes to a quiet and unheralded end.
But few seem to agree with Clarke’s proposal to restructure the CSS Working Group. Many believe the group has life in it yet, while others are calling for the wholesale abandonment of the W3C process.
The voice of reason in all this seems to be Alex Russell of the Dojo Toolkit. In his article, The W3C Cannot Save Us, he explains that what is really holding the Web back is our fanatical devotion to web standards, and the expectation that they can dictate what new features should be added to web browsers.
Put simply, Zeldman is hurting you and only you can make it stop. Neither the CSS WG nor the HTML 5 WG nor, indeed, any W3C working group can define the future. They can only round off the sharp edges once the future becomes the past and that’s all we should ever expect of them. As much as they tell us (and themselves) that they can, and as much as they really would like to, the W3C cannot save us.
Long-time Tech Times readers will not be surprised that I agree with Alex. His opinion is pretty much what I said in the Tech Times #137, way back in April 2006:
In my mind, it shouldn’t be the W3C’s job to develop new standards from scratch, nor should the W3C be responsible for championing new features in individual browsers. Those are the jobs of the innovators and early adopters, who push the boundaries of the possible, producing early implementations that blaze trails for future standards to pave.
The one sticking point that Alex doesn’t mention is software patents. If browsers go out and patent every innovative feature they develop, these features will not be freely available for the W3C to standardize for adoption by the other browsers. But perhaps that’s a smaller problem than the ones we’re faced with currently.
In any case, the W3C needs to stop looking towards the future; until they do, the rest of us will be stuck in the past. The W3C is eminently capable of writing solid specs that describe what browsers do today. They should stick to that (it’s a big job!), and let the world know that adding nonstandard features to web browsers is not a crime.
The future is not built by consensus in a working group; it’s built by visionaries trying stuff out and making mistakes.
This article provided by sitepoint.com.
Manipulating innerHTML removes events
Others have written about this before, but I thought I’d mention it again, just so you don’t miss it. Aleksandar Vacić found it while playing with tables and their cells. I found it when Robert and I played with nested lists. It works the same across browers. Let me show a quick example: You have a […]
Voice and Tone: Writing to reflect your personality as well as your message (Part 1)
Last week someone posted a question to the WordNerds group regarding the importance of voice and tone in writing. In particular she wanted to know how to convey the importance of voice and tone to colleagues who aren’t professional writers. Not having covered this topic previously I thought I’d give it a go.
Scale of tone? Or is there more to it?
Last week someone posted a question to the WordNerds group regarding the importance of voice and tone in writing. In particular she wanted to know how to convey the importance of voice and tone to colleagues who aren’t professional writers. Not having covered this topic previously I thought I’d give it a go.
Voice and Tone, is there a difference?
After prowling the Web looking for various references on the subject I’ve found that opinions differ on this. Some treat the terms interchangeably, while others see key distinctions. For the purpose of this blog, I will define voice to represent the personality and/or style of the writer and tone to reflect the mood or attitude of the writing in relation to its audience and goal. Today I’ll focus on tone.
Tone and formality
Writers often think of tone as a measure of formality, striking a more serious mood and style for an academic paper, a not-as-serious mood (the equivalent of business casual clothing) for an informative blog entry and a light mood and casual style for an e-mail to a friend. They do this in regard to their audience and publication as though there were a corresponding scale that shows that serious, matter-of-fact writing is taken more seriously by peer-reviewed journals and professors, while a laid-back tone is more welcomed by friends.
While this makes sense to a degree, I’m not sure that such a scale is accurate. When deciding whether a writer is well-informed and making a good case, I’m more likely to consider how the information is organized, the logic of the arguments made, and any related sources, than I am the seriousness of tone. Where I will consider the tone is when it comes to readability. Is the piece so dry that I’m asleep before I finish? Does it match the subject matter? Is it appropriate to the message or does it make the writer seem disingenuous? Some writers will strike a serious tone to seem more authoritative, when in fact that tone seems false, making us question—rather than trust—the authority.
When matching seriousness of tone to audience it’s equally important to match the tone to our goals. Are we writing to inform? To persuade? To warn? To amuse? To console?
If I were writing guidelines for the safe-handling of sodium, my first instinct might be to take a very serious tone. Sodium is dangerous, it shouldn’t be touched by human hands, mixed with water, bla bla bla. Yet, if I’m giving these guidelines to students, I want them to pay attention, both to keep them safe and to keep them interested. While I want to make sure they don’t hurt themselves, I also don’t want to scare them away from the study of chemistry. Rather than just giving them somber warnings about explosions, perhaps it would be appropriate to follow the example of Theodore Gray—who documented his sodium party experiments in text and video. Gray’s tone is moderately serious with a hint of humor, clearly demonstrates the dangers of sodium, yet still makes one want to learn more about it. Had he kept his tone too serious or dry no one would have paid much attention, but by striking the right balance, his story was passed along and mentioned in Slashdot and other media.
Tone and attitude
To be serious, or not, is but one measure of tone. Plenty of people stop there, but I think there is much more to it. Humorous writing may be sarcastic, flippant, silly or ironic (among others). Complaints can be angry, bitter, sad, cautious, polite, intense, etc. Tone comes in a wide range of attitudes, some of which may overlap. This is where things get tricky. It’s (relatively) easy to write something that sounds serious and professional. That’s the tone I’ve used so far today. But have I struck the right mood? In taking a straightforward approach to the topic, am I sounding condescending or collegial? Pedantic or informative? Have I so bored you that you’re now asleep—dreaming that your lobster ice-cream franchise failed because you just couldn’t compete with your rival’s spicy crab cones?
These are the questions I must ask myself. When I re-read something, I’ll question the mood. Is it too dry? Too goofy? Too dark? Does it suit the topic? Will it engage the reader? Today the fight has been to avoid being too dry or condescending. My goal is to offer some friendly advice, not to come off as some authoritarian know-it-all. To capture the right mood, I’ll need to keep tweaking things. I’ll replace sentences like:
“Writers are often confounded by such nuances.” (Man, that sounds pompous.) with “This is where things get tricky.”
Then I’ll make sure that I’ve used contractions and added a few quirky ideas—such as the bit about the lobster ice-cream. Perhaps I’ll also switch perspective. Notice how the bits I’ve written in first person seem more friendly than those in third person? Vocabulary, perspective and punctuation can all color the tone of the text. With that in mind I’ll keep reading and tweaking until it sounds good enough to post. Good enough depends on your objective—given my time restraints I’ll spend less time polishing a blog entry than I might an article for print publication. (That’s my disclaimer in case I still didn’t get the mood spot on!)
Recommendations
Choosing a tone, writing, then editing to reflect that tone seems to be what works best for me. It also helps to let someone else read your work. They may notice an attitude that you didn’t. When they suggest a change to a word or phrase, take it under consideration. As writers we’re often protective of our work, but if we’re writing to be read, then we need to listen to our readers. They won’t always be right, but they won’t always be wrong either. Viewing your work through their eyes, will give you a new perspective, and often some very good ideas.
Also remember, you don’t always have to sound serious to be taken seriously.
Voice and Tone Resources
- A Word About Style, Voice, and Tone
- At the Sound of Your Tone…Part 1
- Individual and Appropriate Voice
- The difference between tone and voice
- Thinking Rhetorically: Consider Your Voice, Tone, and Persona
- Tone: A Matter of Attitude
- Tone in Business Writing
To learn more, read Part 2: Voice
Future of web standards (my take)
Stuart Landridge sums up the ongoing debate about the future of CSS. My thoughts on this are that we should: 1. Let browser makers run loose with implementing new features, based on feedback from web developers. 2. Have a standard body (or some other group) that look at those existing features and see how they can be […]
The state of functional programming in PHP
With the rise of Javascript, and languages like Python and Ruby, functional programming is becoming more mainstream. Even Java seems to be getting closures in the next version, so does this leave PHP lacking behind or is there an unrealised potential hidden within? Dynamic dispatch What exactly defines a functional programming language, is perhaps an open question, […]
With the rise of Javascript, and languages like Python and Ruby, functional programming is becoming more mainstream. Even Java seems to be getting closures in the next version, so does this leave PHP lacking behind or is there an unrealised potential hidden within?
Dynamic dispatch
What exactly defines a functional programming language, is perhaps an open question, but one key element is functions as data. As it happens, PHP kind-of-supports this concept; The syntax permits you to use variables as function-names, making the following possible:
function add($a, $b) { return $a + $b; } $add = "add"; $add(2, 8); // return 10
Unlike languages with first class functions support, the variable $add isn’t a special type — It’s merely a string, which is evaluated in the context. It may just be a wrapped up eval, but superficially it works similar, once the function has been declared.
It is also possible to explicitly call a function reference with call_user_func. This is interesting, because it accepts different types of arguments, which makes it possible to call a method on an object. More on this in a moment.
Binding state
Another prerequisite for functional programming, is the ability to bind a variable to a function. This bound function serves essentially the same purpose as objects do in object oriented programming, but is usually more fine grained and more flexible.
In languages, which are traditionally associated with functional programming, functions are usually bound with variables, through something called a closure. This is a side effect of the scoping rules of those languages.
Since PHP doesn’t have lexical scope, we can’t use closures, but we can use currying to achieve the same goal. In Wikipedia’s words, currying is the technique of transforming a function that takes multiple arguments into a function that takes a single argument. If that sounds abstract, assume the following:
$add2 = curry($add, 2); // returns a new function reference, to add(), bound with 2 as the first argument $add2(8); // return 10
Before you try that out, hold your horses — it won’t work, because curry isn’t a PHP function. As it turns out though, it’s possible to create it. Sort of.
Implementing curry
Without going into great details, there are two ways, currying can be implemented in PHP.
- The first option is some sort of run-time evaluated code. This could be variable-variables, pointing to function names or callback pseudotype, invoked by call_user_func. Eventually, they are just kinds of eval.
- The other option is to use a command object, encapsulating the callback and its state.
For a more detailed explanation, have a look at Partial function application in PHP.
Weighing the options
Looking at the syntax, variable-variables have a much more functional “feel” to them, than a command object. The callback pseudotype does allow one to reference an object + method-name, but even though this is supported by PHP’s internal functions, it get’s bulky in user land code. If a command object feels like functional programming with OOP syntax, then call_user_func feels like functional programming with procedural syntax.
When it comes to performance, the run-time evaluated approach has some serious shortcomings. Currying must be done by creating new static code each time and this can’t be reclaimed until the end of the process. Furthermore, the only way to bind state, using this pattern, is to rely on a global container of some sort, generating a new, unique symbol each time. Since it’s impossible to know, when the callback isn’t referred anymore, it follows, that it’s impossible to safely remove the variable from the global container. Thus, any state bound this way, will be impossible to reclaim for PHP’s memory management system, furthering the risk of the script running out of memory.
In conclusion
So, if the offset for this post was to assert the current options for functional programming in PHP, the only practical solution is currying, using command objects. The awkwardness can be somewhat smoothed out, with a library of utility classes. phunctional is an attempt at this and we might also see some of these ideas emerge into more general purpose frameworks.
Another idea, could be a language level addition to PHP. What we need, is a way to make all callbacks callable with the variable-variable syntax. I’m thinking this could be supported with a magic-method. If an object was to be used as a function, and it implemented said magic method, the method would be called. From a design perspective, it would fit fine with the other magic methods, such as __call and friends.
Declaring functions
Another limitation, which could be addressed at the language level, is the matter of declaring functions in the first place. Currently, functions must be declared in the global scope or through the use of the hideous create_function. There have been some stabs at improving this, on the php-internals team, so maybe we should be as lucky as to see this in PHP 6?
This article provided by sitepoint.com.
Lexical scope to appear in PHP?
I mentioned briefly, in my last post, that Wez Furlong made a patch back in March, that allows a native syntax for creating anonymous functions. This could replace the heinous create_function. Since then, I brought up Wez’ original patch again on the php-internals lists. This has prompted some hefty debate over the last week. The main […]
I mentioned briefly, in my last post, that Wez Furlong made a patch back in March, that allows a native syntax for creating anonymous functions. This could replace the heinous create_function.
Since then, I brought up Wez’ original patch again on the php-internals lists. This has prompted some hefty debate over the last week. The main argument against approving the patch, seems to be, that one would expect static scoping rules to apply to the anonymous function. After all, this is the case in similar languages, which support anonymous functions. One could only assume, that changing PHP to support this, would be a major undertaking.
One would be wrong, it seems.
Today, Christian Seiler posted a patch to allow lexical scope for anonymous functions. There are a few loose ends, but it appears to work in general. Instead of making all variables follow the static scoping rules, a new keyword (lexical) is introduced. It works similar to global, in that it must be explicitly declared, which variables are lexically scoped. This is how it looks in action:
function getAdder($x) { return function ($y) { lexical $x; return $x + $y; }; } $add2 = getAdder(2); $add2(8); // return 10
It’s probably a bit early to tell if this will find its way into the language. It’s still just a proposal and it would take some further work to get it right, but at least it appears to be technically possible. We’ll have to wait and see.
Otherwise, there’s just left to wish you all a merry Christmas.
This article provided by sitepoint.com.
Headline
. This not only filled up your page with a lot of extra code, but it also meant that if you decided later to make all of your
’s a different color you would have to go and change all of the font codes one by one. When using a style sheet you can define how your
’s will look in one place. To change the color you just make the one change in the stylesheet and you are ready to go.
Separation of format and presentation isn’t a particularly new idea, but adoption has spread slowly. CSS 1 was first introduced in 1996 and the CSS 2 recommendation has been around since 1998. While many sites use CSS, it is still not uncommon to stumble upon current sites that are still using older codes such as .
Why this has been on my mind
A few weeks ago a friend sent me a link to a pretty cool looking site for an online magazine. Alas the site wasn’t standards compliant and therefore didn’t work properly. This particular site was Flash-based with dimensions too big to fit my screen. The page had no scroll bars so I couldn’t get to the menus to navigate through the site. I could see the whole site on my Mac, but not on my Dell, and I’m pretty sure I’m not the only one to have had that problem. Since I couldn’t navigate the site, they might as well have posted a page that said “Do Not Enter. We don’t care about your business.” If they had built a compliant site they would have ensured greater accessibility to users and not had this problem.
I’ve found a number of other non-compliant sites while working to compile a list of local Web developers. Departments without Web staff often look to outsource their Web projects and turn to me for referrals. Thus I’m trying to put together a list of local (to support the regional economy) developers who I can trust to build compliant sites that follow the Case design scheme, maintain a logical navigational structure and support the goals of the client. This has not been an easy task.
The problem is that almost anyone can learn to build a Web site, but only a few can do it well. There are a lot of firms out there, but the quality of work varies dramatically, and only a handful build standards compliant sites. Sites with major compliance errors don’t end up on my list. This isn’t just because I’m persnickety. If a site fails validation because of a few stray &’s or they’ve forgotten to close a few
’s I’m not worried. Such errors are easily corrected and don’t disturb the overall functionality of the site. But if a site uses tags, doesn’t include a doctype, leaves alt tags blank on all of their images, etc., then I will conclude that its designers are not professional and will not be able to offer the client the advice or service necessary to implement a successful site.
Conclusion and Disclaimer
If you’ve ever built a Web site, you’ve followed at least a few of the standards. The site wouldn’t work if you hadn’t. For example if you left out the
tag your page wouldn’t render. Since we’re all following some of the standards anyway, I would just encourage everyone to learn and apply more of them. As you become more familiar with them you’ll find that your sites become both easier to use and easier to build. To learn more about Web standards visit The Web Standards Project and the resources below.Standards compliance is an ongoing goal of mine, but I’m only human. Not every site I’ve built is standards compliant, and the errors become more egregious the older the pages may be. Since I readily acknowledge this you don’t need to go hunt them down, they are out there, and I know it!
Web Standards Resources
- Asterisk Web Standards Archive
- Designing With Web Standards, Second Edition by Jeffrey Zeldman
- Jeffrey Zeldman: King of Web Standards (Business Week)
- Section 508: The Road to Accessibility
- The Web Standards Group
- The Web Standards Project
- W3C Cascading Style Sheets, level 2 CSS2 Specification
- W3C Cascading Style Sheets, level 1
- W3C HTML 3.2 Reference Specification
- W3C HTML 4.01 Specification
- W3C XHTML™ 1.0 The Extensible HyperText Markup Language (Second Edition)
- W3C Technical Reports and Publications
- Web Accessibility Initiative (WAI)
- World Wide Web Consortium (W3C)
What italic means
Finally an image that dispells all myths about the element. As you can see it’s all about presentation. Disappear you foul demon! (You have more HTML humor? Show me in the comments)
Quick Accessibility Testing
A recent project of mine required me to do a quick review of the accessibility level of a site. Nothing serious, just to show what was possible to test and where the site scored right now. I managed to assemble a small list of tools that I believe did a rather good job. This article […]
CSS3 Media queries instead of the media attribute
In my previous post about the media attribute I talked about how strange the media attribute is, and that its usefulness isn’t that obvious. As a followup I want to point you to an article that Russell Beattie wrote about CSS3 media queries. Media queries are a way to check the capabilities of a user-agent […]
Clarke Calls for CSS Working Group to be Disbanded
Having recently announced the CSS Eleven initiative to provide designer feedback and input into the W3C’s CSS Working Group, Andy Clarke has responded to the Opera-Microsoft antitrust action by calling for the Group to be dissolved entirely and rebuilt without browser vendors in a controlling role. He considers this necessary not only […]
Having recently announced the CSS Eleven initiative to provide designer feedback and input into the W3C’s CSS Working Group, Andy Clarke has responded to the Opera-Microsoft antitrust action by calling for the Group to be dissolved entirely and rebuilt without browser vendors in a controlling role.
He considers this necessary not only because he doubts that the representatives of Opera and Microsoft can collaborate on CSS3 while locked in a legal battle, but also because he feels it’s time the future of web standards was led by those of us who will eventually use them in our daily work, not those who hope to make money by making browsers.
Clarke’s indictment of Opera’s legal action has been echoed by many in the web design community. CSS expert Eric Meyer considers the Opera move to be bad timing, coming right when Microsoft was showing promise with IE7 and the upcoming IE8:
It’s the wrong move at the wrong time, sending precisely the wrong signal to Microsoft about the importance of participating in development and support of open standards, and I can only hope that it comes to a quiet and unheralded end.
But few seem to agree with Clarke’s proposal to restructure the CSS Working Group. Many believe the group has life in it yet, while others are calling for the wholesale abandonment of the W3C process.
The voice of reason in all this seems to be Alex Russell of the Dojo Toolkit. In his article, The W3C Cannot Save Us, he explains that what is really holding the Web back is our fanatical devotion to web standards, and the expectation that they can dictate what new features should be added to web browsers.
Put simply, Zeldman is hurting you and only you can make it stop. Neither the CSS WG nor the HTML 5 WG nor, indeed, any W3C working group can define the future. They can only round off the sharp edges once the future becomes the past and that’s all we should ever expect of them. As much as they tell us (and themselves) that they can, and as much as they really would like to, the W3C cannot save us.
Long-time Tech Times readers will not be surprised that I agree with Alex. His opinion is pretty much what I said in the Tech Times #137, way back in April 2006:
In my mind, it shouldn’t be the W3C’s job to develop new standards from scratch, nor should the W3C be responsible for championing new features in individual browsers. Those are the jobs of the innovators and early adopters, who push the boundaries of the possible, producing early implementations that blaze trails for future standards to pave.
The one sticking point that Alex doesn’t mention is software patents. If browsers go out and patent every innovative feature they develop, these features will not be freely available for the W3C to standardize for adoption by the other browsers. But perhaps that’s a smaller problem than the ones we’re faced with currently.
In any case, the W3C needs to stop looking towards the future; until they do, the rest of us will be stuck in the past. The W3C is eminently capable of writing solid specs that describe what browsers do today. They should stick to that (it’s a big job!), and let the world know that adding nonstandard features to web browsers is not a crime.
The future is not built by consensus in a working group; it’s built by visionaries trying stuff out and making mistakes.
This article provided by sitepoint.com.
Manipulating innerHTML removes events
Others have written about this before, but I thought I’d mention it again, just so you don’t miss it. Aleksandar Vacić found it while playing with tables and their cells. I found it when Robert and I played with nested lists. It works the same across browers. Let me show a quick example: You have a […]
Voice and Tone: Writing to reflect your personality as well as your message (Part 1)
Last week someone posted a question to the WordNerds group regarding the importance of voice and tone in writing. In particular she wanted to know how to convey the importance of voice and tone to colleagues who aren’t professional writers. Not having covered this topic previously I thought I’d give it a go.
Scale of tone? Or is there more to it?
Last week someone posted a question to the WordNerds group regarding the importance of voice and tone in writing. In particular she wanted to know how to convey the importance of voice and tone to colleagues who aren’t professional writers. Not having covered this topic previously I thought I’d give it a go.
Voice and Tone, is there a difference?
After prowling the Web looking for various references on the subject I’ve found that opinions differ on this. Some treat the terms interchangeably, while others see key distinctions. For the purpose of this blog, I will define voice to represent the personality and/or style of the writer and tone to reflect the mood or attitude of the writing in relation to its audience and goal. Today I’ll focus on tone.
Tone and formality
Writers often think of tone as a measure of formality, striking a more serious mood and style for an academic paper, a not-as-serious mood (the equivalent of business casual clothing) for an informative blog entry and a light mood and casual style for an e-mail to a friend. They do this in regard to their audience and publication as though there were a corresponding scale that shows that serious, matter-of-fact writing is taken more seriously by peer-reviewed journals and professors, while a laid-back tone is more welcomed by friends.
While this makes sense to a degree, I’m not sure that such a scale is accurate. When deciding whether a writer is well-informed and making a good case, I’m more likely to consider how the information is organized, the logic of the arguments made, and any related sources, than I am the seriousness of tone. Where I will consider the tone is when it comes to readability. Is the piece so dry that I’m asleep before I finish? Does it match the subject matter? Is it appropriate to the message or does it make the writer seem disingenuous? Some writers will strike a serious tone to seem more authoritative, when in fact that tone seems false, making us question—rather than trust—the authority.
When matching seriousness of tone to audience it’s equally important to match the tone to our goals. Are we writing to inform? To persuade? To warn? To amuse? To console?
If I were writing guidelines for the safe-handling of sodium, my first instinct might be to take a very serious tone. Sodium is dangerous, it shouldn’t be touched by human hands, mixed with water, bla bla bla. Yet, if I’m giving these guidelines to students, I want them to pay attention, both to keep them safe and to keep them interested. While I want to make sure they don’t hurt themselves, I also don’t want to scare them away from the study of chemistry. Rather than just giving them somber warnings about explosions, perhaps it would be appropriate to follow the example of Theodore Gray—who documented his sodium party experiments in text and video. Gray’s tone is moderately serious with a hint of humor, clearly demonstrates the dangers of sodium, yet still makes one want to learn more about it. Had he kept his tone too serious or dry no one would have paid much attention, but by striking the right balance, his story was passed along and mentioned in Slashdot and other media.
Tone and attitude
To be serious, or not, is but one measure of tone. Plenty of people stop there, but I think there is much more to it. Humorous writing may be sarcastic, flippant, silly or ironic (among others). Complaints can be angry, bitter, sad, cautious, polite, intense, etc. Tone comes in a wide range of attitudes, some of which may overlap. This is where things get tricky. It’s (relatively) easy to write something that sounds serious and professional. That’s the tone I’ve used so far today. But have I struck the right mood? In taking a straightforward approach to the topic, am I sounding condescending or collegial? Pedantic or informative? Have I so bored you that you’re now asleep—dreaming that your lobster ice-cream franchise failed because you just couldn’t compete with your rival’s spicy crab cones?
These are the questions I must ask myself. When I re-read something, I’ll question the mood. Is it too dry? Too goofy? Too dark? Does it suit the topic? Will it engage the reader? Today the fight has been to avoid being too dry or condescending. My goal is to offer some friendly advice, not to come off as some authoritarian know-it-all. To capture the right mood, I’ll need to keep tweaking things. I’ll replace sentences like:
“Writers are often confounded by such nuances.” (Man, that sounds pompous.) with “This is where things get tricky.”
Then I’ll make sure that I’ve used contractions and added a few quirky ideas—such as the bit about the lobster ice-cream. Perhaps I’ll also switch perspective. Notice how the bits I’ve written in first person seem more friendly than those in third person? Vocabulary, perspective and punctuation can all color the tone of the text. With that in mind I’ll keep reading and tweaking until it sounds good enough to post. Good enough depends on your objective—given my time restraints I’ll spend less time polishing a blog entry than I might an article for print publication. (That’s my disclaimer in case I still didn’t get the mood spot on!)
Recommendations
Choosing a tone, writing, then editing to reflect that tone seems to be what works best for me. It also helps to let someone else read your work. They may notice an attitude that you didn’t. When they suggest a change to a word or phrase, take it under consideration. As writers we’re often protective of our work, but if we’re writing to be read, then we need to listen to our readers. They won’t always be right, but they won’t always be wrong either. Viewing your work through their eyes, will give you a new perspective, and often some very good ideas.
Also remember, you don’t always have to sound serious to be taken seriously.
Voice and Tone Resources
- A Word About Style, Voice, and Tone
- At the Sound of Your Tone…Part 1
- Individual and Appropriate Voice
- The difference between tone and voice
- Thinking Rhetorically: Consider Your Voice, Tone, and Persona
- Tone: A Matter of Attitude
- Tone in Business Writing
To learn more, read Part 2: Voice
Future of web standards (my take)
Stuart Landridge sums up the ongoing debate about the future of CSS. My thoughts on this are that we should: 1. Let browser makers run loose with implementing new features, based on feedback from web developers. 2. Have a standard body (or some other group) that look at those existing features and see how they can be […]
The state of functional programming in PHP
With the rise of Javascript, and languages like Python and Ruby, functional programming is becoming more mainstream. Even Java seems to be getting closures in the next version, so does this leave PHP lacking behind or is there an unrealised potential hidden within? Dynamic dispatch What exactly defines a functional programming language, is perhaps an open question, […]
With the rise of Javascript, and languages like Python and Ruby, functional programming is becoming more mainstream. Even Java seems to be getting closures in the next version, so does this leave PHP lacking behind or is there an unrealised potential hidden within?
Dynamic dispatch
What exactly defines a functional programming language, is perhaps an open question, but one key element is functions as data. As it happens, PHP kind-of-supports this concept; The syntax permits you to use variables as function-names, making the following possible:
function add($a, $b) { return $a + $b; } $add = "add"; $add(2, 8); // return 10
Unlike languages with first class functions support, the variable $add isn’t a special type — It’s merely a string, which is evaluated in the context. It may just be a wrapped up eval, but superficially it works similar, once the function has been declared.
It is also possible to explicitly call a function reference with call_user_func. This is interesting, because it accepts different types of arguments, which makes it possible to call a method on an object. More on this in a moment.
Binding state
Another prerequisite for functional programming, is the ability to bind a variable to a function. This bound function serves essentially the same purpose as objects do in object oriented programming, but is usually more fine grained and more flexible.
In languages, which are traditionally associated with functional programming, functions are usually bound with variables, through something called a closure. This is a side effect of the scoping rules of those languages.
Since PHP doesn’t have lexical scope, we can’t use closures, but we can use currying to achieve the same goal. In Wikipedia’s words, currying is the technique of transforming a function that takes multiple arguments into a function that takes a single argument. If that sounds abstract, assume the following:
$add2 = curry($add, 2); // returns a new function reference, to add(), bound with 2 as the first argument $add2(8); // return 10
Before you try that out, hold your horses — it won’t work, because curry isn’t a PHP function. As it turns out though, it’s possible to create it. Sort of.
Implementing curry
Without going into great details, there are two ways, currying can be implemented in PHP.
- The first option is some sort of run-time evaluated code. This could be variable-variables, pointing to function names or callback pseudotype, invoked by call_user_func. Eventually, they are just kinds of eval.
- The other option is to use a command object, encapsulating the callback and its state.
For a more detailed explanation, have a look at Partial function application in PHP.
Weighing the options
Looking at the syntax, variable-variables have a much more functional “feel” to them, than a command object. The callback pseudotype does allow one to reference an object + method-name, but even though this is supported by PHP’s internal functions, it get’s bulky in user land code. If a command object feels like functional programming with OOP syntax, then call_user_func feels like functional programming with procedural syntax.
When it comes to performance, the run-time evaluated approach has some serious shortcomings. Currying must be done by creating new static code each time and this can’t be reclaimed until the end of the process. Furthermore, the only way to bind state, using this pattern, is to rely on a global container of some sort, generating a new, unique symbol each time. Since it’s impossible to know, when the callback isn’t referred anymore, it follows, that it’s impossible to safely remove the variable from the global container. Thus, any state bound this way, will be impossible to reclaim for PHP’s memory management system, furthering the risk of the script running out of memory.
In conclusion
So, if the offset for this post was to assert the current options for functional programming in PHP, the only practical solution is currying, using command objects. The awkwardness can be somewhat smoothed out, with a library of utility classes. phunctional is an attempt at this and we might also see some of these ideas emerge into more general purpose frameworks.
Another idea, could be a language level addition to PHP. What we need, is a way to make all callbacks callable with the variable-variable syntax. I’m thinking this could be supported with a magic-method. If an object was to be used as a function, and it implemented said magic method, the method would be called. From a design perspective, it would fit fine with the other magic methods, such as __call and friends.
Declaring functions
Another limitation, which could be addressed at the language level, is the matter of declaring functions in the first place. Currently, functions must be declared in the global scope or through the use of the hideous create_function. There have been some stabs at improving this, on the php-internals team, so maybe we should be as lucky as to see this in PHP 6?
This article provided by sitepoint.com.
Lexical scope to appear in PHP?
I mentioned briefly, in my last post, that Wez Furlong made a patch back in March, that allows a native syntax for creating anonymous functions. This could replace the heinous create_function. Since then, I brought up Wez’ original patch again on the php-internals lists. This has prompted some hefty debate over the last week. The main […]
I mentioned briefly, in my last post, that Wez Furlong made a patch back in March, that allows a native syntax for creating anonymous functions. This could replace the heinous create_function.
Since then, I brought up Wez’ original patch again on the php-internals lists. This has prompted some hefty debate over the last week. The main argument against approving the patch, seems to be, that one would expect static scoping rules to apply to the anonymous function. After all, this is the case in similar languages, which support anonymous functions. One could only assume, that changing PHP to support this, would be a major undertaking.
One would be wrong, it seems.
Today, Christian Seiler posted a patch to allow lexical scope for anonymous functions. There are a few loose ends, but it appears to work in general. Instead of making all variables follow the static scoping rules, a new keyword (lexical) is introduced. It works similar to global, in that it must be explicitly declared, which variables are lexically scoped. This is how it looks in action:
function getAdder($x) { return function ($y) { lexical $x; return $x + $y; }; } $add2 = getAdder(2); $add2(8); // return 10
It’s probably a bit early to tell if this will find its way into the language. It’s still just a proposal and it would take some further work to get it right, but at least it appears to be technically possible. We’ll have to wait and see.
Otherwise, there’s just left to wish you all a merry Christmas.
This article provided by sitepoint.com.