[Pharo-project] Unicode depending on Zinc

Sven Van Caekenberghe sven at beta9.be
Fri Mar 16 06:49:13 EDT 2012

If you want to avoid hardcoding a class reference to Zn, you could do a simple download like this:

	'http://zn.stfx.eu/zn/numbers.txt' asZnUrl retrieveContents

It avoids an entry to Undeclared or the ugly test, and it since it is implemented as

	"Download and return the resource that I refer to.
	This will typically return a String or a ByteArray (see ZnClient>>#get:).
	If something goes wrong, an exception will be signalled."
	" 'http://zn.stfx.eu/zn/numbers.txt' asZnUrl retrieveContents. "
	^ ZnClient new
		enforceHttpSuccess: true;
		get: self

it is easy to use for simple scripting.


On 16 Mar 2012, at 00:24, Igor Stasenko wrote:

> you can always make dependency less hardcoded:
> Smalltalk at: #ZnClient ifAbsent: [ self error: 'sorry dude' ]
> ifPresent: [:client |
>  ... download stuff , whatever ]
> On 16 March 2012 00:18, Guillermo Polito <guillermopolito at gmail.com> wrote:
>> That's why I generated a method from the file, and then put the link in the
>> comment...
>> On Thu, Mar 15, 2012 at 8:17 PM, Guillermo Polito
>> <guillermopolito at gmail.com> wrote:
>>> But what if I want to have an image without Zinc?  Ok, I will not use that
>>> method, but I'll get an Undeclared entry and therefore a dirty image... :/
>>> On Thu, Mar 15, 2012 at 12:37 PM, Sven Van Caekenberghe <sven at beta9.be>
>>> wrote:
>>>> Hi Guillermo,
>>>> On 15 Mar 2012, at 16:25, Guillermo Polito wrote:
>>>>> Of course with a nice comment saying something like:
>>>>> "Initialize the mappings from unicode lower to upper case and vice
>>>>> versa.  sourceCodes and destinyCodes contains the unicode values for the
>>>>> mappings, and they match one by one.
>>>>> The source of this mapping can be found at:
>>>>> http://www.unicode.org/Public/UNIDATA/CaseFolding.txt' "
>>>> Have a look at what I did with
>>>> http://code.google.com/p/pharo/issues/detail?id=4187
>>>> The spec tables are constants, like in your latest example, but I added a
>>>> method that can generate these from an internet accessible resource (using
>>>> Zn as HTTP client). That way, there is some kind of dependency, but not
>>>> really at run time. I think it is cool to literally use these public spec
>>>> documents.
>>>> Sven

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4334 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20120316/b284e8c5/attachment.p7s>

More information about the Pharo-dev mailing list