0

As the title puts, I really don't know what @@DEBUG or some other @@stringName mean in JavaScript I mean.

Anybody got an idea there?

Many thanks


I've saw it used via string literal, or a variable, as follows:

// the 1st scene
angular.module('myApp', []).value('appConst', {'dbServer' : '@@DBSERVER'});

// the 2nd scene
if (@@DEBUG) {
  window.root = $rootScope;
}
// some other logic

Thx, all!


Now that, I've found out where does this double '@' come from, it's from my grunt, build system, as follows:

// In my grunt's replace task
replace : {
  server: {
    replacements: [{
      from: /@@DBSERVER/g,
      to: yeomanConfig.devSettings.DEV_DBSERVER
    }, {
      from: /@@DEBUG/g,
      to: 'true'
    }]
  }
}

Thx alot, all of the participants.

GrahamLe
  • 359
  • 4
  • 7
  • 3
    I have never seen that before. Are you sure it's in a JavaScript script? please provide more context. – Felix Kling Nov 30 '13 at 06:59
  • 1
    do you mean the jsdoc specifiers, you can check wiki here http://en.wikipedia.org/wiki/JSDoc – Mohamed Ali JAMAOUI Nov 30 '13 at 06:59
  • @MohamedAliJamaoui: JSDoc tags start only start with one `@`. – Felix Kling Nov 30 '13 at 07:00
  • yes that's why i was asking because i have never seen @@debug – Mohamed Ali JAMAOUI Nov 30 '13 at 07:03
  • 2
    No offense, but why does this question have two up votes? Do people really think that *"This question shows research effort; it is useful and clear"*? If yes, we have a very different ideas about "research effort" and "clear". – Felix Kling Nov 30 '13 at 07:13
  • @FelixKling Have you ever *tried* googling for a phrase that contains special characters? – Gustav Bertram Nov 30 '13 at 08:26
  • @Gustav: Maybe googling for e.g. `@@DEBUG` is not necessary. Maybe the context gives enough other clues for what to look for. I'm not saying that the question is not valid. I'm only saying that it is not upvote-worthy. – Felix Kling Nov 30 '13 at 08:30
  • for @MohamedAliJamaoui , I just bumped into this issue in my project recently.. now I guess definitely there is a double @.., it's a string literal sometimes, but in project I do see it is uesd like : if (@@DEBUG) { ... } – GrahamLe Nov 30 '13 at 10:13

3 Answers3

2

This is ASP.NET MVC razor view engine syntax.If you used MVC, you can use this syntax in JavaScript by using razor view. So I think you have little bit confusing for razor syntax with JavaScript.

and also this type of syntax only can write sql-transaction

please see this image

enter image description here

Sad News, Google not searching with that symbol on javascript

Community
  • 1
  • 1
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234
0

UPDATE:

Whatever the code you're looking at (and you should edit your post to include an example) it is not pure Javascript, because Javascript syntax does not use any @ signs.

If you want to confirm that for yourself, you can go through the Javascript syntax reference page on the Mozilla Developer Network.

I've added examples of code that does use @@ here to help you identify your code.

This is most likely C# Razor syntax:

<span>In Razor, you use the 
@@foo to display the value 
of foo</span>

It is used to escape the @ when you want to print the @ and not a variable.

Source: http://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx

It could be Ruby syntax:

def self.debug
  return @@debug
end

In Ruby @@ indicates a class variable.

Ref: https://stackoverflow.com/a/5890199/1005039

It could also be MySQL syntax:

set debug= 'T';
select @@debug;
@@debug
T
set debug= '+P';
select @@debug;
@@debug
P:T
set debug= '-P';
select @@debug;
@@debug
T

In MySQL, @@ indicates variables

Source: http://dev.mysql.com/doc/refman/5.0/en/set-statement.html

It could also be PostgreSQL syntax:

SELECT description 
FROM product 
WHERE description @@ '%apple%'

Source: Postgres match operator @@

Community
  • 1
  • 1
Gustav Bertram
  • 14,591
  • 3
  • 40
  • 65
  • So, you are saying that it is not related to JavaScript at all? Your answer is proof of why this is a bad question. There just is not enough information to give a definite answer. – Felix Kling Nov 30 '13 at 09:11
  • A lot of the questions here are for future searchers. I think that maybe someone else searching for `javascript` and `@@` may find the list of languages that *do* use it as syntax useful. – Gustav Bertram Nov 30 '13 at 09:21
  • thx, I've got that~~It ain't a Js syntax.. – GrahamLe Nov 30 '13 at 10:31
0

@@FOO is invalid as JavaScript grammar - unless it happens to be inside a comment, string literal or regular expression literal.

Thus, it's either not JavaScript or has special meaning (to someone, but not JavaScript) in one of the following forms:

// @@FOO
"@@FOO";
/@@FOO/;

It could also be a processing directive in a build system or template engine or valid grammar in a different language; but it is not JavaScript.

user2864740
  • 60,010
  • 15
  • 145
  • 220