Re: C# programmer wants to learn assembly?? plz help
- From: "Dragontamer" <prtiglao@xxxxxxxxx>
- Date: 30 Dec 2006 08:42:16 -0800
David Jones wrote:
<//\\\\o//\\\\annabee <"WINOS IS ***.">> wrote...
På Sat, 30 Dec 2006 03:56:29 +0100, skrev David Jones <ncic@xxxxxxxxxx>:
Here's a counter-example: let's say you need to verify that an email
address in a string has the format something@xxxxxxxxxxx? (string +
'@' + string + '.' + string, with only one @ in the string) See how
long it takes you to write it in assembly.
Then compare to ECMAScript: /^[^\s\@]+\@[^\s\@]+\.[^\s\@]+$/.test(str)
Guess which one would take longer for me to write.... (hint: if I wrote
the code above while I was typing my reply, the ECMAScript version
didn't take too long -- show me the equivalent with RosAsm, please)
I am uberdrunk, but lets give it a try:
call IsEmailAddress
That's really disingenuous, you know. First of all, I have no
documentation for this library function, so I can't tell if it *EXACTLY*
meets the specification I listed. Second, who says an HLL can't have a
library function that does the same thing?
You completely missed the point. Write the validation in assembly just
using the base language. *YOU'RE* the one who stated writing from
scratch is easier in assembly, yet when it comes time to actually do it,
you don't want to. If it's so much easier, and it makes you so much
more productive, prove it.
Look at the phone number validation in my reply to ¬a\/b and give me the
RosAsm version:
Accept any of:
(202) 555-1212
(202)555-1212
202/555-1212
202.555.1212
2025551212
HLL version:
if (/^(\(\d{3}\)\s?)?\d{3}[\-\.]\d{4}$/.test(str) ||
/^\d{3}([\-\.])\d{3}\1\d{4}$/.test(str) ||
/^\d{3}\/\d{3}[\-\.]?\d{4}$/.test(str) ||
/^\d{3}?\d{7}$/.test(str))
{
// ... valid ...
}
else
{
// ... invalid ...
}
ECMAscript?? Ewww... Go Perl :-)
if(string =~ m/\(?\d{3}\)?\s*\d{3}(-|.)?\d{4}/ )
There, and no nasty || statements making the example
excessivly long.
Took about 1 minute but no test yet; cause I suck with Perl
and don't feel like compile-checking :-p
Does ECMAscript have grouping? In Perl you can just
do \d{3}(-|.)?\d{3} and that will match each of the following:
123-123
123.123
123123
The (-|.) is basically an "or". Basically, \d is equivalent to
(1|2|3|4|5|6|7|8|9|0).
--Dragontamer
.
- Follow-Ups:
- Re: C# programmer wants to learn assembly?? plz help
- From: David Jones
- Re: C# programmer wants to learn assembly?? plz help
- References:
- C# programmer wants to learn assembly?? plz help
- From: giddy
- Re: C# programmer wants to learn assembly?? plz help
- From: Frank Kotler
- Re: C# programmer wants to learn assembly?? plz help
- From: //\\\\o//\\\\annabee
- Re: C# programmer wants to learn assembly?? plz help
- From: Herbert Kleebauer
- Re: C# programmer wants to learn assembly?? plz help
- From: Betov
- Re: C# programmer wants to learn assembly?? plz help
- From: Herbert Kleebauer
- Re: C# programmer wants to learn assembly?? plz help
- From: Betov
- Re: C# programmer wants to learn assembly?? plz help
- From: Herbert Kleebauer
- Re: C# programmer wants to learn assembly?? plz help
- From: David Jones
- Re: C# programmer wants to learn assembly?? plz help
- From: David Jones
- Re: C# programmer wants to learn assembly?? plz help
- From: David Jones
- C# programmer wants to learn assembly?? plz help
- Prev by Date: Re: C# programmer wants to learn assembly?? plz help
- Next by Date: Re: C# programmer wants to learn assembly?? plz help
- Previous by thread: Re: C# programmer wants to learn assembly?? plz help
- Next by thread: Re: C# programmer wants to learn assembly?? plz help
- Index(es):