Jump to content

Dany

Members
  • Content Count

    128
  • Joined

  • Last visited

Everything posted by Dany

  1. OK, i see. Thanks for the additional info. Typically it is wise to pin a variable upon installation to a certain type. Do you mean var a = 0; instead of var a; ... a = 0; when you write "pin"? IMO SMS should always try to generate as efficient JS code as possible. That asked and said, do you agree that this should be formalised and documented? And do you agree with my sentiment regarding the warnings? TIA, /D
  2. Just a note regarding this (if it might help); i can not use themes when running in a Window10 VW. The scrolling of TSynEdit/Memo get extremely sluggish. This is on a not-4K-screen. /D
  3. Hello again! When looking at the resulting JS it seems that SMS will initialize most / all variables implicitly. There's nothing wrong with that (apart from some performance considerations but i'm not sure they would apply here). Anyway, i'm getting compiler warnings that does not 100% match when i let it implicitly initialize. In Delphi, for example, some (locals) variables are initialized and others are not (fields?). The warning are utterly important here because an uninitialized variable that happened to become 0 during development might not during deployment. In Java the once
  4. Need som input, I have some overridden globals called "Debug". They output stuff to the console. I put ifdefs inside these functions for a release deploy and imagined that the calls would be linked away. Of course not, stupid idea. So, do you have any ide of how to "keep" my debug calls and take them out all in one shot for release? TIA, /D
  5. I have been comparing output and fiddling with the options. This is difficult partly because somestuff only surfaces in certain projects and i have the feeling that the changes to the options does not click all times or they are interdependent (one does not give effect without the other). So; is there a thorough description of the options somewhere? Preferrably with examples and the rationale behind it's existance. That would be top-knotch IMHO. Regards, /Dany
  6. DWScript/SMS has a Map function that maps to JavaScripts Map function. From page 13 of the Smart Book: Declare an array and do lMyArray.Map( and you'll see what pascal function you should create as the argument. The Map function iterates an array and creates a new one holding a mapped item for each. http://www.w3schools.com/jsref/jsref_map.asp The Filter function iterates an array and creates a new one holding the same type but potentially fewer items. http://www.w3schools.com/jsref/jsref_filter.asp So when i want a map: StrJoin(FIds.Map(lambda (v: Integer): st
  7. It would be really nice. Doing it the asm-way is tedious. The Map function's CodeInsight is really useful. Is there a list of compiler intrinsic stuff for each version? That would also be good. TIA
  8. This is a workaround, but i'm not sure it works in all browsers/platforms. procedure TCustomApplication.HandleUncaughtExceptions(evt: JEvent); var lErrEvt := JErrorEvent(evt); begin var lPascalMessage: String; if (TVariant.AsObject(lErrEvt.error) is Exception) then lPascalMessage := Exception(TVariant.AsObject(lErrEvt.error)).message; DisplayError( Format('%s %s %s %s: %s', [lErrEvt.message, lErrEvt.filename, lErrEvt.lineno, lErrEvt.colno, lPascalMessage]) ); evt.preventDefault; // Supresses console output, optional. end; Depending on what i pu
  9. Maybe someone knows if there is a possibility to prototype the "root" exception handler i a browser and add the possibility to parse the Exception object?
  10. Maybe i asked this before, sorry in that case. When i use the keyword raise the compiler will only accept an "Exception object". It seems this object is magically defined by the compiler (?). My problem is that such an exception object is too "Pascalish". The JS VM (or whoever) can not show me anything useful, just "Object". If you run code like "CL", well it's fine because loops are simulated and there's somewhere to catch the exceptions. But if you want to write "pure" JS stuff, this is not possible. Is there any way to raise for example a string (without using an asm sect
  11. Should i not be able to do this in SMS Pascal? function a(const id: string; aClass: class of JElement): String; begin Result := aClass(Document.getElementById(id)); end; Does not compile. I can do this: function TBaseClass.GetClass: class of TBaseClass; begin Result := TSubClassOfBaseClass; end; using it like var lClass := GetClass.Create; TIA, /Dany
  12. I am definitely not trying to shun the webkit/F12 tools. They are absolutely necessary. And i live inside there a lot. And i guess that the feat of integrating Chrome like in the JetBrain product line would be over the top for the SMS team. But we could save a lot of woe, for example by having a function that could jump to a row in the source in the selected browser window... That is but one thingy. No?
  13. I've also never had debugging working. Anyone has a better way of debugging instead of this (note the pages can not be locally retrieved): Compile, Switch to <Chrome> Reload Open "Source", Ctrl+F, search for the place Set a breakpoint "Execute" Is there maybe a way to jump into the produced script from the SMS IDE? That would help a lot. Could you expand on how you are making use of the source maps? TIA, /Dany
  14. Dany

    Adding events

    Sorry, posted too fast. Ignore this. Apologies, /Dany
  15. Dany

    Adding events

    Hello! I wanted to add an event that would prevent a click. This can be done by casting and affecting the event object, and it can also be done by returning false from the handler. So i added this at the top of the unit: JEventTarget = partial class external 'EventTarget' public procedure addEventListener(&type: String; callback: function: Boolean; capture : Boolean = false); overload; procedure addEventListener(&type: String; callback: function(evt: JEvent): Boolean; capture : Boolean = false); overload; procedure removeEventListener(&type: String; callback:
  16. @Ñuño, yes. *That* is a "legitimate" reson! Good luck, /D
  17. Dany

    Search in the IDE

    @markus_ja, well i get false negatives when the field clears, but this is *not* 100%. It varies.
  18. Dany

    Search in the IDE

    1. My text field is not empty in the search box. This makes it even worse because i do not know when i get a false negative. 2. I also have to agree with the poster above on the delete key for the search field. 3. I remember changing the colour of the search hits, actually. But the fact that hits are painted with the case of the search word and not the case of the hit is still not good and has been reported. Also as a default the choice of colour could be better- I have recorded a gif to show you what i am experiencing. http://www.dany.se/sms/sms_search_false_negative.gif I
  19. OAuth 2.0: http://hueniverse.com/2012/07/26/oauth-2-0-and-the-road-to-hell/ http://www.cnet.com/news/oauth-2-0-leader-resigns-says-standard-is-bad/
  20. Dany

    Search in the IDE

    Seriously! Am i the only one having this problem? It makes the working day *hellish* and it destroys my shoulder. You should hear me swearing. This is quite pressing really and not at all superficial. Search in the IDE is important. I do not understand how this issue can be ignored.
  21. Dany

    Search in the IDE

    A little better after the update to 2.2.0.4461 but still; Select a (complete) word in the sources that is occurring once or only once "below". Press Ctrl+F. Hit Enter. *Sometimes* there's a "not found" message box. Hit Ctrl+Home and F3. "Not found" (again). A false negative! This happens often to me. Running the IDE in a Win10 VirtualBox VM on a Win10 host. Also happens in a Win7 guest /D
  22. Nope, that was wrong. Now, having access to run the code... If i rename Option to Create it will generate: new HTMLOptionElement("hepp","1",false,false) and not new Option(...); So someone needs to have a look-see IMHO... /D
  23. Cool!! I'd still would like SMS compiler to implement "Filter" like it implements "Map" (for arrays). [repeated request and OT]...
  24. Confirmed. Would be really nice to have this in the next version. I did not find any way of using it outside and asm block without changing the RTL sources (W3C.HTML5.pas). TIA, /Dany
  25. Yes, if i change the pas name from Option to Create the correct JS constructor is generated. Thanks. 1½ yrs ago i asked for a writeup on constructors. I still do not understand what happens 100% and i think some of my confusion is due to "faulty" generated W3C.* headers. Stupid of me to "trust" them for learning. Regards, /D
×
×
  • Create New...