I understand your post and I agree that most macros can be rewritten as functions that take other functions. I provide an example of this below for other readers.
But sometimes you can't. Other times its just too dang inconvenient.
Common Lisp defines no "while" form. Nobody complains about this, because its easy to write a macro to implement while:
;; the macro definition (defmacro while (test &body body) `(do () ((not,test)),@body))
Here's a sample call that flips a coin until getting a tails, printing BORK for each heads flip:
;; the macro definition (while (plusp (random 2)) (print 'BORK))
IMHO this is prettier and more intuitive than the function-passing approach:
;; function definition (defun while (testfn bodyfn) (do () ((not (funcall testfn))) (funcall bodyfn)))
Where "(\ ()...)" is my made-up syntax for introducing a function of 0 arguments with "..." as its body.
This approach is what I'd call "too dang inconvenient".:)
I think history bears me out that macros are the superior approach, as most languages do NOT implement while as a function.;)
Also there's an efficiency argument to be made against passing too many functions with "closed variables", as this will often cause those variables to be heap allocated instead of (faster) stack allocated. On the other hand 99% of the time you've got a fast enough computer to not care, but I have had times where the efficiency matters.
To really get off topic, even for this thread, I like LISP macros, because they can do dangerous things like variable capture. Perl has almost every flow control construct binding $_ to the most recent interesting expression. If I wanted to add that functionality to LISP, I could easily do so without touching a line of source code. I create my own package that uses most of the symbols from the lisp package, but has its own definitions for if, while, etc:
;; "my:if" is this alternate-universe "if", which ;; binds "it" to the test caluse result. ;; "cl:if" is the normal lisp "if". (defmacro my:if (test then else) `(let ((it,test)) (cl:if it),then,else)))
Presumably users of these functions will intentionally refer to the symbol "it" to get the test result. That's all there is to Perl's $_. I don't think you can do this by passing around functions. (in any case not prettily:)
I'll just point out you can easily put macro's in classes and use them like this (assuming you have an OpenGL class):
Eh, there are some things you can't do with this approach that you can do with macros. A (fairly trivial) instance in my example is how it lets you specify a variable name (color), which then gets bound to the color of the window. Uses of "color" in "non-boiler-plate-code" thus handily become references to the window's color.
If this is what Jabba does, then Jabba will lose.
on
Why Java Won't Have Macros
·
· Score: 4, Informative
The crux of his argument is that user defined macros make code unreadable. If users are able to create their own macro constructs, they'll be "making their programs unreadable for everyone else". This is pure hogwash from someone that's probably never used hairy-chested lisp macros seriously. I'll demonstrate to you the hogwashishness in two phases.
Flash-back to 1969 when the same arguments were put forward by assembly programmers against named functions:
User defined
functions make code unreadable. If users are able to create their own functions, they'll be "making their programs unreadable for everyone else".
History has show that user defined functions are good. People are finally realizing that lisp macros are perhaps an equally important good. By taking this position, Jabba is positioning itself on the losing side of history.
If you look at it in terms of lines of code, in terms of error-prone-ness, in terms of high-level versus low-level, in terms of maintainability, ONLY AN IDIOT WOULD CHOOSE AGAINST MACROS.
Okay, sorry for being ornery, but mod this scruffy post up!
From the subject I assumed that there were awards for good game journalism. Singling out the reporters that cut through the marketing hype to reveal what was really good and what was tripe.
It seems there are millions of game reviews, but hardly any reviews of game reviewers. Everyone knows who's side "Nintendo Power" magazine is on, but certain supposedly impartial mags are actually in the corporate pockets.
For a long time I've been wondering how to hack my cellphone. This BREW thing looks a little...cough...heavy. Is programability only a feature of high end phones?
I work for a bike courier company. I want to overlay the text message functionality with my own menus and logic. Basically we get runs as text messages, then I want to hit 1 key to reply with "run recieved", then another for "pick up complete", then another for "drop off complete". I also want to load in the metrics of our (grid shaped) city and have it run the travelling salesman problem for me. (ya ya, its NP-complete, but still EZ for n=3 runs)
QUALCOMM's BREWâ solution is a complete, open product and business system for the development and over-the-air deployment of data services on wireless devices. The BREW solution provides the necessary tools and value-added services to developers, device manufacturers and wireless operators for application development and distribution, device configuration, and billing and payment. Through its BREW solution, QUALCOMM delivers the following products and services:
BREAKING NEWS: CUSTOMER LEAKS THE 80 LINES OF 'COPIED' CODE
At last, the copied code is revealed. Here it is!:
/*
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow. ...
Yeah, and normally when you see something in quotes, like hilarity is 'bound' to ensue this is a tipoff that the writer is quoting someone who he doesn't necessarily agree with.
Although another school of thought has it that quotes are just for adding emphasis, e.g. "Free" Car Wash. When misunderstood to be the first, more common interpretation, hilarity often ensuses.
There are lots of reasons to have really good bulk storage technology. But what's the killer app that's going to get the $10^9/year in government spending? Can you say "Domestic Surviellance" boys and girls? I knew you could!
\blockquote{(okay okay, you can use alt too)} This is IMO the cardinal sin of window managers: stealing important application keystrokes. If I find a WM camping on Alt-mouse or Alt-key, preventing my hungry hungry hippo (emacs) from getting them, its uninstalled faster than you can say "twm".
If I want a window manager to steal keystrokes, I do it on a bucky bit that hardly anyone uses anymore, like "super" or "hyper". Then I rebind my keyboard to make those keys accessible. My caps-lock is now super, kills two birds with one stone.
Hm, well I think I had a different perspective on the whole thing, having participated in the original War3 Beta, seeing, e.g. the Keeper going from great to crappy to great about 4 times.
Balancing a game such that so-so players percieve "balance" and first tier players percieve balance is some tricky shit.:) Not that I was ever a first tier player, mind you.
The game is friggin about micromanagement, because if they tried to do macro management on current hardware with their current visual quality, joe-sixpack's GPU would melt. That's plain enough.
As to "doing things in the exact order", that's totally untrue. You could make the same argument about chess, and you'd be wrong there too. It sounds like you're playing someone much better than you. Against equal skill levels you should have several options.
Heh, by the way, I'm a minorly famous War3 player. Or was so "back in the day". Check out my screenshot-cartoon of a game on US East
So Linux is dumping constantly, while MS only dumps sometimes.
Linux is *not* free. People have to write it. This takes computers, time, and education. That its authors choose to give it away out of the niceness of their hearts, is happy coincidence, and the only way MS can really hope to compete is by doing the same.
[Linux developers] just give away the fruit of their labors
And MS is giving away the fruit of its labors, too. The only difference is: Linux charges the same to every client, while MS charges differently depending on who you are (joe consumer vs munich vs student). I don't see how one can be a criminal offense (dumping) while another is not.
I'm not trying to troll. In fact I have given away the fruits of my labors a few times too.
If we were talking about Xboxes or cars, then yes this would be dumping. But since linux is constantly being given away at below cost, I don't see how we linux zealots can really get grumpy about this.
"You MS Bastards are selling your OS for $30 dollars, which is less than it cost for you to make! You're dumping."
`What about linux?`
"It costs $0 retail and cost gazillions to develop"
A lot of it depends on location. In San Fran & the East Bay most houses don't have A/C because it only gets hot enough to use it about 2 weeks of the year.
If you're really dedicated and have done all the things the grandparent of this post mentioned, it might be time to go to Lowes/HomeDepot and buy $70 worth of blow-in insulation (read: big bales of pocket-lint). Such a purchase allows you to borrow their insulation blower. You install the insulation it in your attic. If you have balls you can charge your landlord $1000 for the installation. (Professionals charge even more).
Common Lisp defines no "while" form. Nobody complains about this, because its easy to write a macro to implement while:
Here's a sample call that flips a coin until getting a tails, printing BORK for each heads flip:IMHO this is prettier and more intuitive than the function-passing approach:Where "(\ ()This approach is what I'd call "too dang inconvenient". :)
I think history bears me out that macros are the superior approach, as most languages do NOT implement while as a function. ;)
Also there's an efficiency argument to be made against passing too many functions with "closed variables", as this will often cause those variables to be heap allocated instead of (faster) stack allocated. On the other hand 99% of the time you've got a fast enough computer to not care, but I have had times where the efficiency matters.
To really get off topic, even for this thread, I like LISP macros, because they can do dangerous things like variable capture. Perl has almost every flow control construct binding $_ to the most recent interesting expression. If I wanted to add that functionality to LISP, I could easily do so without touching a line of source code. I create my own package that uses most of the symbols from the lisp package, but has its own definitions for if, while, etc:
Presumably users of these functions will intentionally refer to the symbol "it" to get the test result. That's all there is to Perl's $_. I don't think you can do this by passing around functions. (in any case not prettilyEh, there are some things you can't do with this approach that you can do with macros. A (fairly trivial) instance in my example is how it lets you specify a variable name (color), which then gets bound to the color of the window. Uses of "color" in "non-boiler-plate-code" thus handily become references to the window's color.
Flash-back to 1969 when the same arguments were put forward by assembly programmers against named functions:
History has show that user defined functions are good. People are finally realizing that lisp macros are perhaps an equally important good. By taking this position, Jabba is positioning itself on the losing side of history.Seriously, what's easier to read:
ORIf you look at it in terms of lines of code, in terms of error-prone-ness, in terms of high-level versus low-level, in terms of maintainability, ONLY AN IDIOT WOULD CHOOSE AGAINST MACROS.Okay, sorry for being ornery, but mod this scruffy post up!
From the subject I assumed that there were awards for good game journalism. Singling out the reporters that cut through the marketing hype to reveal what was really good and what was tripe.
It seems there are millions of game reviews, but hardly any reviews of game reviewers. Everyone knows who's side "Nintendo Power" magazine is on, but certain supposedly impartial mags are actually in the corporate pockets.
For a long time I've been wondering how to hack my cellphone. This BREW thing looks a little...cough...heavy. Is programability only a feature of high end phones?
I work for a bike courier company. I want to overlay the text message functionality with my own menus and logic. Basically we get runs as text messages, then I want to hit 1 key to reply with "run recieved", then another for "pick up complete", then another for "drop off complete". I also want to load in the metrics of our (grid shaped) city and have it run the travelling salesman problem for me. (ya ya, its NP-complete, but still EZ for n=3 runs)
Tobbacco's so hard to work into a salad. Maybe they should make some anti-rabies Tomacco instead?
If you're from a small publication, lie like a dog and say you're from "Computer Gaming World" or something like that?
At last, the copied code is revealed. Here it is!:
Although another school of thought has it that quotes are just for adding emphasis, e.g. "Free" Car Wash. When misunderstood to be the first, more common interpretation, hilarity often ensuses.
There are lots of reasons to have really good bulk storage technology. But what's the killer app that's going to get the $10^9/year in government spending? Can you say "Domestic Surviellance" boys and girls? I knew you could!
Meta-L mouse-drag-secondary
Meta-M mouse-yank-secondary
Meta-R mouse-secondary-save-then-kill
\blockquote{(okay okay, you can use alt too)}
This is IMO the cardinal sin of window managers: stealing important application keystrokes. If I find a WM camping on Alt-mouse or Alt-key, preventing my hungry hungry hippo (emacs) from getting them, its uninstalled faster than you can say "twm".
If I want a window manager to steal keystrokes, I do it on a bucky bit that hardly anyone uses anymore, like "super" or "hyper". Then I rebind my keyboard to make those keys accessible. My caps-lock is now super, kills two birds with one stone.
To summarise the article: nobody really thinks this is news until they test it on the actual substance (carbon-carbon) that the wing is made out of.
Hm, well I think I had a different perspective on the whole thing, having participated in the original War3 Beta, seeing, e.g. the Keeper going from great to crappy to great about 4 times.
:) Not that I was ever a first tier player, mind you.
Balancing a game such that so-so players percieve "balance" and first tier players percieve balance is some tricky shit.
The game is friggin about micromanagement, because if they tried to do macro management on current hardware with their current visual quality, joe-sixpack's GPU would melt. That's plain enough.
As to "doing things in the exact order", that's totally untrue. You could make the same argument about chess, and you'd be wrong there too. It sounds like you're playing someone much better than you. Against equal skill levels you should have several options.
Heh, by the way, I'm a minorly famous War3 player. Or was so "back in the day". Check out my screenshot-cartoon of a game on US East
So Linux is dumping constantly, while MS only dumps sometimes.
Linux is *not* free. People have to write it. This takes computers, time, and education. That its authors choose to give it away out of the niceness of their hearts, is happy coincidence, and the only way MS can really hope to compete is by doing the same.
I enjoyed your reply. It does deserve better than score 0.
I can't wait for "Men of Proofreading", which looks to be one of the more eagerly-awaited prepositional phrases of recent!
Well, uh, this is good. :)
And MS is giving away the fruit of its labors, too. The only difference is: Linux charges the same to every client, while MS charges differently depending on who you are (joe consumer vs munich vs student). I don't see how one can be a criminal offense (dumping) while another is not.
I'm not trying to troll. In fact I have given away the fruits of my labors a few times too.
If we were talking about Xboxes or cars, then yes this would be dumping. But since linux is constantly being given away at below cost, I don't see how we linux zealots can really get grumpy about this.
"You MS Bastards are selling your OS for $30 dollars, which is less than it cost for you to make! You're dumping."
`What about linux?`
"It costs $0 retail and cost gazillions to develop"
So how is Linux not dumping?
A lot of it depends on location. In San Fran & the East Bay most houses don't have A/C because it only gets hot enough to use it about 2 weeks of the year.
If you're really dedicated and have done all the things the grandparent of this post mentioned, it might be time to go to Lowes/HomeDepot and buy $70 worth of blow-in insulation (read: big bales of pocket-lint). Such a purchase allows you to borrow their insulation blower. You install the insulation it in your attic. If you have balls you can charge your landlord $1000 for the installation. (Professionals charge even more).
picture
God damn, it doesn't even work with linux. No wonder nobody's heard of it.
And Gator would be .... ?