FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Some ideas.

 
Post new topic   Reply to topic     Forum Index -> MiniD
View previous topic :: View next topic  
Author Message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Tue Mar 27, 2007 3:40 pm    Post subject: Some ideas. Reply with quote

Actually, first, there's a typo in the docs. In the language spec, on the Statements page, in the Foreach Statements section, the example expansion code uses the colon syntax for calling the opApply member rather than a dot. Smile


Now on the ideas. I really do like Mini-D so far, and hope to use it for future scripting purposes. I noticed its just a step and a half from being "JSON complete" so to say. All it needs is an eval() function or the like so that JSON notation can be automatically interpreted, and to allow for strings in place of identifiers in Table constructors. That is, make {foo=9} and {"foo"=9} identical.

Number two: default assignment. This is a notion I take from ColdC, where the statement 'foo ?= 42;' is the same as 'if (!foo) foo = 42;'. In MiniD I would suggest it be the same as 'if (foo is null) foo = 42;'.

Number three -- and I may have just missed these -- provide looping operations for arrays. 'filter', 'find', and 'map'. It'd be easy enough for users to write them in, but their utility (opinion) merits being standard.

Lastly, and this is important for me, add support for Tango. Wink

Keep up the good work!
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Tue Mar 27, 2007 5:02 pm    Post subject: Reply with quote

Quote:
Actually, first, there's a typo in the docs. In the language spec, on the Statements page, in the Foreach Statements section, the example expansion code uses the colon syntax for calling the opApply member rather than a dot.


NOOOOOOOOOOOOOOOOOOOOO

Quote:
I noticed its just a step and a half from being "JSON complete" so to say. All it needs is an eval() function or the like so that JSON notation can be automatically interpreted, and to allow for strings in place of identifiers in Table constructors. That is, make {foo=9} and {"foo"=9} identical.


But doesn't JSON use a colon to separate the key and the value?

Quote:
Number two: default assignment. This is a notion I take from ColdC, where the statement 'foo ?= 42;' is the same as 'if (!foo) foo = 42;'. In MiniD I would suggest it be the same as 'if (foo is null) foo = 42;'.


That's a pretty cool idea. It'd also make "default parameters" a little quicker to type.

Quote:
Number three -- and I may have just missed these -- provide looping operations for arrays. 'filter', 'find', and 'map'. It'd be easy enough for users to write them in, but their utility (opinion) merits being standard.


I've actually added array.map, apply, and reduce, I just haven't submitted the most recent code to the repo yet. But filter and find are good ideas, I'll put them in.

Quote:
Lastly, and this is important for me, add support for Tango.


This one I'm not so sure will happen, at least not in the near future. Fact is I don't know anything about Tango, and I haven't had much luck installing/using it. That, and I'm kind of ... I dunno, partial to phobos, though there are certainly areas where I find it lacking (i.e. total lack of support for anything but char[]). And then I'd have to manage two versions of everything, especially the standard libraries, which are of course very much dependent upon the D standard library in use, but I guess that's my responsibility after all..
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Tue Mar 27, 2007 11:26 pm    Post subject: Reply with quote

JarrettBillingsley wrote:
Quote:
Actually, first, there's a typo in the docs. In the language spec, on the Statements page, in the Foreach Statements section, the example expansion code uses the colon syntax for calling the opApply member rather than a dot.

NOOOOOOOOOOOOOOOOOOOOO


I feel your pain.

JarrettBillingsley wrote:
Quote:
I noticed its just a step and a half from being "JSON complete" so to say. All it needs is an eval() function or the like so that JSON notation can be automatically interpreted, and to allow for strings in place of identifiers in Table constructors. That is, make {foo=9} and {"foo"=9} identical.

But doesn't JSON use a colon to separate the key and the value?


In the process of answering this, I accidentally answered the quotes issue too. Wink I was just going to say it wouldn't take much of a string replace or regexp replace to switch those colons out... which, incidentally, means it wouldn't take much of one to parse it utterly. An MD JSON lib would suffice grandly.

Still, eval() might have its uses... Wink But admittedly problematic to implement, I'm sure.

JarrettBillingsley wrote:
Quote:
Number two: default assignment. This is a notion I take from ColdC, where the statement 'foo ?= 42;' is the same as 'if (!foo) foo = 42;'. In MiniD I would suggest it be the same as 'if (foo is null) foo = 42;'.

That's a pretty cool idea. It'd also make "default parameters" a little quicker to type.


Bingo!

JarrettBillingsley wrote:
Quote:
Lastly, and this is important for me, add support for Tango.

This one I'm not so sure will happen, at least not in the near future. Fact is I don't know anything about Tango, and I haven't had much luck installing/using it. That, and I'm kind of ... I dunno, partial to phobos, though there are certainly areas where I find it lacking (i.e. total lack of support for anything but char[]). And then I'd have to manage two versions of everything, especially the standard libraries, which are of course very much dependent upon the D standard library in use, but I guess that's my responsibility after all..


And your answer is pretty much what I expected. A quick manual scan through some of MiniD leads me to think, however, that it should be possible. If its just absolutely necessary to have a Tango "fork", I can try to donate a little of my own time to see it achieved.

In fact -- Would you have any problem with me attempting to re-engineer a current snapshot of MiniD to use Tango? Daunting, but I do get spats of boredom sometimes.

Edited to add:
Incidentally I found another oops in the docs: there's no mention of isNamespace() in the BaseLib page. I assume that probably just hasn't been gotten to since as I recall you only just made Namespaces distinct in this way recently.
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Wed Mar 28, 2007 6:39 am    Post subject: Reply with quote

Quote:
An MD JSON lib would suffice grandly.


Yeah, it could be a little derivation of the compiler. Or even put support for it into the compiler, but not have it part of the language; just make it so a function call would parse it and turn it right into MiniD code.

Quote:
Still, eval() might have its uses...


Yeah, I plan on making an eval() function. I've seen some pretty cool metaprogramming-esque stuff done in Lua with it.

Quote:
In fact -- Would you have any problem with me attempting to re-engineer a current snapshot of MiniD to use Tango?


Nope, that'd be sweet.

Quote:
there's no mention of isNamespace() in the BaseLib page.


Once again: NOOOOOOOOOOOOOOOO
Back to top
View user's profile Send private message
DavidWright



Joined: 05 Oct 2015
Posts: 1
Location: London

PostPosted: Mon Oct 05, 2015 10:42 pm    Post subject: Reply with quote

if you need any kind of writing help. Do let me know.
_________________
Assignment Help

Dissertation Help
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MiniD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group